How to set max scroll position?
Let's say that we have body width of page set to 2000px with content centered horizontally inside of body with width set to 1200px. <body> <div class="content"></div> </body> CSS: body { width: 2000px; } .content { position: relative; width: 1200px; margin-left: auto; margin-right: auto; } What I am trying to achieve is that I do not allow horizontal scrolling at all until your window size is 1200px or less (on resize) with setting overflow-x to hidden. $(function() { $(window).resize(function() { if(window.innerWidth > 1200) { $("body").css({ "overflow-x": "hidden" }); } else { $("body").css(
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.