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
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();

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.