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
Post a Comment