Jump to content

Scroll to bottom of the page


gerkintrigg

Recommended Posts

Hi guys.

 

I can get an ajax script to work fine here: http://www.truro.com (just click on "Membership Signup" at the bottom), but I then want to scroll down to the bottom of the page because otherwise when the Ajax window opens, it's kinda hidden below the fold.

 

Do you know of a handy tip to allow me to do that? I don't want to have to get into Javascript refreshes and stuff.

 

Any help much appreciated.

 

Neil

Link to comment
https://forums.phpfreaks.com/topic/265232-scroll-to-bottom-of-the-page/
Share on other sites

There are a couple things you can do.  You can set document.scrollTop to a value to scroll to a particular point on the screen.  Setting it to the same value as document.scrollHeight will take you to the bottom of the page.

 

If you want to show a specific element you can call element.scrollIntoView() which will cause the browser to scroll so that element is visible on the page.

 

So for your member signup form you could do:

document.getElementById('membership_signup_form').scrollIntoView();

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.