我使用以下代码禁用桌面浏览器中的滚动,但它不适用于 iPhone 屏幕分辨率。
$("html").css("overflow", "hidden");
我还需要添加什么吗?
最佳答案
//target the entire page, and listen for touch events
$('html, body').on('touchstart touchmove', function(e){
//prevent native touch activity like scrolling
e.preventDefault();
});
如果阻止触摸事件对您不起作用,您可以随时这样做:
html, body{
max-width:100%;
max-height:100%;
overflow:hidden;
}
关于jquery - 如何禁用智能手机和平板电脑浏览器中的滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10097937/