javascript - How do I scroll to the right on a page that overflows horizontally? -


i want scroll far right edge of page wide (it's wide on purpose) when user closes modal (specifically, reveal modal in foundation 4).

i've tried setting id on div that's aligned way right, doesn't work.

to scroll horizontally, use scrollleft().

$('body, html').scrollleft(400); 

jquery supports animating scrollleft property.

to scroll way right, full width of page, , subtract window width left edge :

var left = $(document).outerwidth() - $(window).width(); $('body, html').scrollleft(left); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -