【发布时间】:2017-02-27 13:33:33
【问题描述】:
我一直在尝试停止在触摸设备中滚动,为此我使用了 touchmove 事件:
$('body').on('touchmove.sidebar', function(e){
e.preventDefault();
});
在 Chrome 控制台中,我看到警告:
由于目标,无法在被动事件侦听器中阻止默认值 被视为被动。看 https://www.chromestatus.com/features/5093566007214080
在github 上,建议使用touch-action: none 而不是preventDefault()。所以我的问题是:
我应该同时使用preventDefault() 和touch-action: none 还是只使用后者?后者是否适用于 firefox 和其他触摸浏览器?
【问题讨论】:
标签: javascript css google-chrome scroll