I'm trying to create a one page site where initially when scrolling the page will go down vertically, it then gets to a full page width/height section at the bottom where I want the scrolling direction to change to horizontal.
I have been using the following code to change the scroll direction to horizontal when it reaches the bottom of the page:
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$("body").css("overflow-x", "auto", "overflow-y", "hidden");
$('html, body, *').mousewheel(function(e, delta) {
this.scrollLeft -= (delta * 30);
e.preventDefault();
});
}
});
However I need a method which will also revert the direction from scrolling top to bottom and then left to right to right to left and bottom to top. I'm relatively new to jQuery and i'm unsure of the best way to achieve this.