I need to disable the ability to scroll up the html page when I go beyond a certain point. I also need a mechanism to return to the top of the specified page.
I tried to accomplish this with the following code, but it still did not work for me because the page is reacting (thus, the location of the point may change with the size of the window).
$(function() { var scrollPoint = 200; var scrolledPast = false; $(window).scroll(function() { $(window).scrollTop() > scrollPoint ? scrolledPast = true : ''; $(window).scrollTop() < scrollPoint && scrolledPast == true ? $(window).scrollTop(scrollPoint) : ''; }).scroll(); });
Can this be done using Javascript / JQuery?
source share