代碼如下:
/**
* lu封裝
*/
(function () {
if (!window.lu) {
window.lu = {};
};
window.lu = {
mo: function (e) {
e.preventDefault();
e.stopPropagation();
},
/** 頁面禁止滑動 */
stop: function () {
// document.body.style.overflow = 'hidden';
$('body').css({
'position': 'fixed',
'height':'100%',
'width': '100%',
'overflow': 'hidden'
});
document.addEventListener("touchmove", this.mo, false); //禁止頁面滑動
},
/***取消滑動限制***/
move: function () {
// document.body.style.overflow = ''; //出現滾動條
$("body").css({
'position': 'initial',
'height': '100%',
'width': '100%',
'overflow':''
});
document.removeEventListener("touchmove", this.mo, false);
}
};
})();
該方法在百度浏覽器和