在桌面浏览器上滑动后防止点击触发
Prevent click firing after swipe on desktop browser
我正在为 Web 应用程序使用 touchswipe,但我也希望它能在桌面上运行(特别是 chrome)。但是,它会在滑动后触发点击。有没有办法阻止它这样做?
我有一个 jsfiddle 这个
$(".swiper").swipe({
tap: function(event, target) {
alert('tap');
},
swipe:function(event, direction, distance, duration, fingerCount){
alert('swipe');
}
});
$(".swiper").on("click",function () {alert("click")});
我试过 return false 、 stopPropogation 等但无济于事。
使用最新的 Js https://cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.js
看到这个discussion
和gitdiff
示例:http://jsfiddle.net/kevalbhatt18/quycddab/1/
$(document).ready(function () {
var swipFlag = false;
$(".swiper").swipe({
tap: function (event, target) {
alert('tap');
},
swipe: function (event, direction, distance, duration, fingerCount) {
console.log(event)
alert('swipe');
}
});
});
我正在为 Web 应用程序使用 touchswipe,但我也希望它能在桌面上运行(特别是 chrome)。但是,它会在滑动后触发点击。有没有办法阻止它这样做?
我有一个 jsfiddle 这个
$(".swiper").swipe({
tap: function(event, target) {
alert('tap');
},
swipe:function(event, direction, distance, duration, fingerCount){
alert('swipe');
}
});
$(".swiper").on("click",function () {alert("click")});
我试过 return false 、 stopPropogation 等但无济于事。
使用最新的 Js https://cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.js
看到这个discussion
和gitdiff
示例:http://jsfiddle.net/kevalbhatt18/quycddab/1/
$(document).ready(function () {
var swipFlag = false;
$(".swiper").swipe({
tap: function (event, target) {
alert('tap');
},
swipe: function (event, direction, distance, duration, fingerCount) {
console.log(event)
alert('swipe');
}
});
});