gerkintrigg Posted July 5, 2012 Share Posted July 5, 2012 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 More sharing options...
kicken Posted July 5, 2012 Share Posted July 5, 2012 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 https://forums.phpfreaks.com/topic/265232-scroll-to-bottom-of-the-page/#findComment-1359282 Share on other sites More sharing options...
Mahngiel Posted July 5, 2012 Share Posted July 5, 2012 What if you put a false anchor in the bottom of the page, below the footer? If you named it name="SignUp", your URI will be clearer as well. Link to comment https://forums.phpfreaks.com/topic/265232-scroll-to-bottom-of-the-page/#findComment-1359325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.