移动端设备禁止页面滑动

一种方法:

html头部添加

<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">

然后将页面body的高度设为window的高度

 $("body").height( $(window).height() );

其他方法

页面高度超过设备可见高度时,阻止掉touchmove事件。

document.body.addEventListener('touchmove', function (event) {
    event.preventDefault();
}, false);


http://segmentfault.com/q/1010000000322091
posted @ 2015-11-24 15:59  小橘籽  阅读(483)  评论(0编辑  收藏  举报