有没有人知道如何支持Touchswipe.js?
该脚本可以很好地检测大多数设备上的滑动,但不是在IE中...
$(this).swipe( { allowPageScroll:"vertical",
swipe:function(event, direction, distance, duration, fingerCount, fingerData) {
if(direction == 'right'){
console.log('swiped right');
}
if(direction == 'left'){
console.log('swiped left');
}
},
threshold:0
});发布于 2015-03-12 02:33:32
我发现一个两步的过程,包括触摸支持,它非常简单。
首先添加到你的CSS
html {
-ms-touch-action: none; /* Direct all pointer events to JavaScript code. */
}然后添加到您的脚本中:
var touchStart = window.navigator.msPointerEnabled ? "MSPointerDown" : "touchstart";
var touchMove = window.navigator.msPointerEnabled ? "MSPointerMove" : "touchmove";
var touchEnd = window.navigator.msPointerEnabled ? "MSPointerUp" : "touchend";https://stackoverflow.com/questions/28993746
复制相似问题