Disable Scroll with open menu

0

I have a menu with 100% width and 100% height, in which I use a button to open it and close it (hamburger style). But when it opens my site it still scrolls behind it. I want to know how I can disable site scrolling when the menu is open, and disable when I close the menu.

    
asked by anonymous 17.02.2016 / 12:18

2 answers

1

I did not get it right, but it might solve it:

You can add a scroll event to jQuery. When the person scrolls the page it checks to see if the menu is open. If it is open, it forces scrollTop always zero (top).

Example: link

    
17.02.2016 / 17:48
-2

The Scroll can be controlled by CSS: link

 body, html { 
     overflow: hidden; 
 }
    
17.02.2016 / 12:33