简体   繁体   English

禁用左右滑动事件

[英]Disabling swipe left and right event

I am gonna disable swipe event (exactly right and left on slider part) on website mobile view.我将在网站移动视图上禁用滑动事件(在 slider 部分上完全向右和向左)。 This is my js code.这是我的js代码。

jQuery(document).on("swipeleft swiperight", '#sample_slider', function(e) {
    e.stopImmediatePropagation();
    e.preventDefault();
});

This doesn't work on #sample_slider element.这不适用于 #sample_slider 元素。

Or did point wrong element for swipe?还是为滑动点了错误的元素?

Use:hover css property and pass pointer-events:none;使用:hover css 属性并传递pointer-events:none; style to the element this should do the trick In your someAction() function you will need to perform this元素的样式这应该可以解决问题 在您的someAction() function 中,您需要执行此操作

However, as a dev to dev using the @click event like this is the dumbest way to use Vue.. but considering that there might be a need in your app for this i think my solution should help you但是,作为开发人员使用 @click 事件这样的开发人员是使用 Vue 的最愚蠢的方式。但考虑到您的应用程序可能需要这样做,我认为我的解决方案应该对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM