html - jQuery Horizontal Scroll to DIV on Click -


i have parallax setup user can scroll down when on landing of site. once scroll down, can scroll across different pages.

i have tried using jquery code:

$("#scrollto").click(function() { $('html, body').animate({     scrolltop: $("#page2").offset().top }, 2000); 

});

i want make when user clicks button scrolls across or horizontally second page "view2". system not seem work.

here fiddle: https://jsfiddle.net/qm7s60ud/1/

the animate should on .wrapper class since element has overflow.

.wrapper {      height: 100%;     background-color: gray;     overflow: auto; //overflow causes div have scroll bar } 

and instead of scrolltop , .offset().top, (because vertical)

it should be scrollleft , .offset().left .. (this horizontal)

working demo


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -