Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    221
    Thanks
    2
    Thanked 0 Times in 0 Posts

    scroll to bottom on load

    i need a page to load scrolled to the bottom... and do it on auto-refresh

    i have a page that auto-refreshes every five seconds, and I need it to scroll to the bottom of the page at every refresh... regardless of whether the page stays the same length (dynamic content).

    i.e. a shoutbox that checks for new shouts every 5 seconds.

    is there a way?

  • #2
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, but that would be a Javascript question.

    However, I gotta wonder: why not just sort them in descending order? It seems to me the repeated scrolling would get annoying, not to mention tedious after many records are returned.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Magnus has a good point but if you want to do it, add this to your body tag in the page you want scrolled to the bottom.
    Code:
    onload="window.scrollTo(0,document['body'].offsetHeight);"

  • #4
    Regular Coder
    Join Date
    Jan 2005
    Posts
    221
    Thanks
    2
    Thanked 0 Times in 0 Posts
    the reason is to have an im styled interface where the input is at the bottom and the posts are in reverse order above it... either way scrolling will be necessary, the question is simply will it be up or down.

  • #5
    Regular Coder
    Join Date
    Jan 2005
    Posts
    221
    Thanks
    2
    Thanked 0 Times in 0 Posts
    i messed up when asking the question... rather than having the window scroll, i need the div with the id "CONTENT" to scroll. how can i do this?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •