禁止用户滑动屏幕的js设置

整   理:晋 哲

时   间:2017-01-06

说   明:弹出框弹出后,当用户滑动屏幕时主体页面应该设置为不能滚动的

一、移动端
禁止滚动设置
$('body').bind('touchmove',function(){return false;});

恢复滚动设置
$('body').unbind('touchmove');

二、PC端
禁止滚动设置
$('body').css({overflow:"hidden"});

恢复滚动设置
$('body').css({overflow:"auto"});

发表评论