h5做的表情滑动切换,设置左右滑动,只能“横着滑”,不能“斜着滑”,“斜着滑”没反应?

用chrome调试的时候,可以“斜着滑”。
在app上,只能水平滑动,稍微斜一点就没反应

swipe : function() {// 表情左右滑动
            $("#slider").on("swipeLeft swipeRight", function(e) {
                var that = this;
                var index = sliderIndex - 1;
                var indicator = 0;
                var len = $('.mui-slider-item').length - 1;
                switch (e.type) {
                    case 'swipeLeft' :
                        if (index == len) {
                            break;
                        }
                        sliderIndex++;
                        index = index + 1;
                        indicator = index;
                        index = 0 - index * 100;

                        $('.mui-slider-loop').animate({
                                    textIndent : 0
                                }, { // 
                                    step : function(now, fx) {
                                        $(this).css(
                                                "transform",
                                                "translate3d(" + index
                                                        + '%,0,0)'

                                        );
                                        $(this).css(
                                                '-webkit-transform',
                                                'translate3d(' + index
                                                        + '%,0,0)');
                                    },
                                    duration : 'slow'
                                }, 'linear');
                        $('.mui-indicator').removeClass("mui-active");
                        $('.mui-indicator').each(function(j) {

                                    if (j == indicator) {

                                        $(this).addClass("mui-active");
                                    }
                                });
                        break;
                    case 'swipeRight' :
                        if (index == 0) {
                            break;
                        }
                        sliderIndex--;
                        index = index - 1;
                        indicator = index;

                        index = 0 - index * 100;

                        $('.mui-slider-loop').animate({
                                    textIndent : 0
                                }, { // 
                                    step : function(now, fx) {
                                        $(this).css(
                                                "transform",
                                                "translate3d(" + index
                                                        + '%,0,0)'

                                        );
                                        $(this).css(
                                                '-webkit-transform',
                                                'translate3d(' + index
                                                        + '%,0,0)');
                                    },
                                    duration : 'slow'
                                }, 'linear');
                        $('.mui-indicator').removeClass("mui-active");

                        $('.mui-indicator').each(function(j) {

                                    if (j == indicator) {
                                        $(this).addClass("mui-active");
                                    }
                                });
                        break;
                }

            })
        },
阅读 1.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题