0

After scrolling to the footer of the page I am not able to scroll upwards, my page gets stuck

I am feeling that that when this.oldScroll == this.scrollY I need to do something to fix this.

$(window).scroll(function () {
    if (this.oldScroll > this.scrollY) {
        scrollDirection = "up";
        userScrolled = true;
    }
    else if (this.oldScroll == this.scrollY) {
        scrollDirection = "none";
        userScrolled = false;
    } else {
        scrollDirection = "down";
        userScrolled = true;
    }
    this.oldScroll = this.scrollY;
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<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><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><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><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

I am expecting that I can scroll up once I reach the bottom of the page

skyline3000
  • 7,639
  • 2
  • 24
  • 33
Sanjan
  • 11
  • 2
  • I've edited your question to include the code as a runnable demo. Running the code snippet doesn't reproduce the problem, you can scroll to the bottom and back up just fine. Are you getting any errors in your console? – skyline3000 May 31 '19 at 02:33
  • I see no way this code could be affecting scrolling at all. It's just recording primitive values. – Tyler Roper May 31 '19 at 03:28
  • This may help you https://stackoverflow.com/questions/1144805/scroll-to-the-top-of-the-page-using-javascript-jquery – Rakesh May 31 '19 at 06:01

0 Answers0