gpt4 book ai didi

jquery - 在移动设备上滚动页面时防止 touchstart

转载 作者:行者123 更新时间:2023-12-01 02:20:49 24 4
gpt4 key购买 nike

我想在用户向下滚动移动设备页面时禁用 touchstart 事件。该页面有各种元素,当您单击时会切换一个类,但我希望当用户向下滑动以向下滚动页面时禁用这些 touchstart 事件。

JQUERY

$(document).on('touchstart click', '.flip-container ', function(event){                       
event.preventDefault();
$(this).find('.flipper').toggleClass('hover');
});

有人知道怎么做吗?谢谢!

最佳答案

var touchmoved;
$('button').on('touchend', function(e){
if(touchmoved != true){
// you're on button click action
}
}).on('touchmove', function(e){
touchmoved = true;
}).on('touchstart', function(){
touchmoved = false;
});

https://stackoverflow.com/a/32120668/3678996

关于jquery - 在移动设备上滚动页面时防止 touchstart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20615605/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com