我一直在利用preventDefault
技术上的touchmove
从现在开始,当我注意到它似乎不再适用于 iOS 11.3、Safari、Chrome 或 Firefox 时:
document.ontouchmove = function(event){
event.preventDefault();
}
iOS 现在有什么变化吗?有什么方法可以防止页面顶部或底部跳动?
在线复制 https://alvarotrigo.github.io/test/pepe/demo2.html
使用 jQuery 在线复制 https://alvarotrigo.github.io/test/pepe/demo.html
视频在这里:
这是由 WebKit 的一个 bug 引起的。错误 182521 https://bugs.webkit.org/show_bug.cgi?id=182521
Try
window.addEventListener("touchstart", function(event) {
event.preventDefault();
}, {passive: false});
作为解决方法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)