How to scroll down / up to scroll the page horizontally?

  • 0
    Hello, I need to make a horizontal scrolling site like https://in.game/ . I can track the up or down roll with this code:
    var scrollTop = $(window).scrollTop();
    
    	$(window).scroll(function() {
    	    if($(window).scrollTop() > scrollTop){
    	        console.log('down')
    	        scrollTop = $(window).scrollTop();
    	    } else{
    	        console.log('up')
    	        scrollTop = $(window).scrollTop();
    	    }
    	});


    So here's how to make sure that when scrolling down, the page scrolls to the right. when scrolling up - to the left?
    JavaScript Anonymous, Aug 23, 2020

  • 1 Answers
  • 0
    I think this will help
    Vivienne Stevens

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!