微信浏览器如何禁止iPhone手机上下滑动网页


或者说 在 iphone 手机上 浏览网页 , 往上滑 会划出 微信浏览器的背景颜色 黑色, uc 浏览器 往上 滑 页会划出 uc 浏览器的 背景色 白色,

网页滑到底部了 还是可以滑 划出浏览器的背景色,

我不想要iphone 这样的 默认 滑动事件 html 页面 改怎么写呢

按照看到以前的


 /*去掉iphone手机滑动默认行为*/
$('body').on('touchmove', function (event) {
    event.preventDefault();
});

这个不行啊 还是会划出浏览器的背景颜色

jquery 微信浏览器 web iphone JavaScript

放开那只⑨ 8 years, 10 months ago

 document.addEventListener('touchmove', function(e) {
    e.preventDefault();
});

mixsoul answered 8 years, 10 months ago

也许你需要再禁止 touchstart 的默认事件


 js


 $('body').on('touchmove touchstart', function (event) {
    event.preventDefault();
});

参考: http://stackoverflow.com/questions/2890361/disable-scrolling-in-an-iph...

薙切·绘里奈 answered 8 years, 10 months ago

Your Answer