用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;
}
})
},