blog
blog copied to clipboard
禁止页面滚动
<meta name="x5-fullscreen" content="true">
<meta name="full-screen" content="yes">
<script type='text/javascript'>
document.querySelector('body').addEventListener('touchstart', function (ev) {
event.preventDefault();
});
</script>
https://segmentfault.com/q/1010000003921576
//实现滚动条无法滚动
var mo=function(e){e.preventDefault();};
/***禁止滑动***/
function stop(){
document.body.style.overflow='hidden';
document.addEventListener("touchmove",mo,false);//禁止页面滑动
}
/***取消滑动限制***/
function move(){
document.body.style.overflow='';//出现滚动条
document.removeEventListener("touchmove",mo,false);
}
http://www.qdfuns.com/notes/17420/d05b4b0710c6dab6a92f79eb5a5628cd
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
document.getElementById('shade').ontouchstart = function(e){ e.preventDefault(); }