css - How to disable the scrolling of the body when the navbar collapse is active -
using bootstrap 3, facing problem disabling body scroll when collapsible nav-bar menu open in mobile devices. when collapse menu open , if swipe on it, background element starts scrolling don't want. want background element should not scroll when swipe on collapsible menu. same problem seen in desktops.
one way accomplish css disable overflow of html
, body
elements.
html, body {margin: 0; height: 100%; overflow: hidden}
<!-- example html create scrollbar --> a<br><br><br><br><br><br><br><br><br><br> b<br><br><br><br><br><br><br><br><br><br> c<br><br><br><br><br><br><br><br><br><br> d<br><br><br><br><br><br><br><br><br><br>
you create class called no-scroll
, apply html
, body
when open menu. remove class when menu closes.
Comments
Post a Comment