在移動端設置overflow:hidden禁止滾動的解決方法


如果你是將overflow:hidden用在了body上那么不管用,因為移動端是基於touch事件。

兩種解決方法:

1、為html和body同時設置height:100%;overflow:hidden;

html, body{
    height:100%;
    overflow:hidden;
}

2、使用touchmove

$(document).on('touchmove',function (e){
    e.preventDefault();
});


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM