It is necessary to disable the scrolling of the page when you click on the button. When you press the same button again, scrolling should turn on again.
I do this through overflow: hidden; for body / html and this trick works everywhere (all browsers on PC, phones on android), except iphone.
For iphone it turns out only when overflow: hidden; applied to the body, and to html, but then when you turn on scrolling, it starts from the beginning of the page, and not from the place where it was turned off.
Tell me, please, some simple and not resource-intensive trick for this.
For clarity or codepen - http://codepen.io/anon/pen/adLVar
$('#div_menu').click( function() { $('body').toggleClass('hide_page'); }); body, html { margin: 0; padding: 0; } #div_menu { position: fixed; top: 0; left: 0; width: 50px; height: 50px; background: #000000; } #div0 { height: 2000px; width: 100%; } .hide_page { overflow: hidden; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="div_menu"> </div> <div id="div0"> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <p>x3</p> </div> Thank you very much to the respondents!