简体   繁体   中英

How to prevent background scrolling when Materializecss modal open on mobile browsers?

How to prevent background scrolling when materializecss modal open on mobile platforms? On desktop browsers the background is prevented from scrolling and works as it should.

On mobile browsers (Safari ios, Chrome ios, etc), when a modal is opened and using your finger to scroll it, the background also scrolls as does the modal. How do I prevent that?

Try this, Wrap your page into a div , and when the modal is open you add overflow: hidden in the div . And be sure if the modal doesn't inherit the overflow from the page wrapper.

I hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM