Page Load: Scroll to Bottom of Page (jQuery)

I had an annoying thing in one of my APEX Applications where after a page refresh, APEX would automatically refocus back to the top of the page. This looks all good for a normal application, but for this one I wanted it to focus on the bottom of the page where the result of the page process would be. Luckily all I had to do was create a dynamic action that fired on page load (conditioned that a hidden item isn’t null, which it wouldn’t be anymore) that ran this little bit of jQuery.

$(window).load(function() {
$("html, body").animate({ scrollTop: $(document).height() }, 3000);
});

This scrolls to the top of the page, but we’ve set the top of the page to be the length of the height of the page, which is actually the bottom. The last parameter which is set to “3000”, is the length of time it takes. I’d suggest just playing with that number until you find out a smooth transition time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s