I have a client who would like to change the functionality of their site so that the user begins at the bottom of the site and has to scroll down to navigate up.
So basically, I need a way to reverse the scrolling functionality so that if you scroll down, it scrolls up instead, and vice versa.
I did a bit of research and found this (How can I determine the direction of a jQuery scroll event?), which gave me what I have below to capture the scroll event:
var lastScrollTop = 0;
$(window).scroll(function (event) {
var st = $(this).scrollTop();
if (st > lastScrollTop) {
// downscroll code
alert("DOWN");
} else {
// upscroll code
alert("UP");
}
lastScrollTop = st;
});
This works fine, it identifies if the user scrolls up or down.
But I don't know what I can do to:
- Stop the default scroll, and
- Scroll in the other direction
Anyone know what I can do here? Or if there's an entirely different way to do this with either a plugin or a different method, I'm up for anything.