移动端阻止body左右偏移
生活随笔
收集整理的這篇文章主要介紹了
移动端阻止body左右偏移
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
如果一直找不到你的CSS問題,就用下面的CSS解決吧
html,body{overflow-x: hidden;}原生JS
function bodyScroll(){e.preventDefault(); } document.addEventListener('touchmove', bodyScroll, false); //阻止 document.removeEventListener('touchmove', bodyScroll, false); //激活或者
document.addEventListener('touchmove', function(event) {event.preventDefault(); }, false);?
或者
function stopScroll(e){document.documentElement.style.overflow='hidden'; }jQuery
$('body').on('touchmove',function(event){event.preventDefault();});?
總結
以上是生活随笔為你收集整理的移动端阻止body左右偏移的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Makefile教程
- 下一篇: kong自定义插件(修改官方插件)