Results 1 to 3 of 3

Thread: Dynamic Ajax Content overflow reset (scrollTop)

  1. #1
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Ajax Content overflow reset (scrollTop)

    1) Script Title:
    Dynamic Ajax Content

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    3) Describe problem:

    Great wee script, but i am having problems getting each page content to load at the top of the div if the scroll bar has been scrolled down...

    To be more concise, the scroll state of the container is being preserved when new content is loaded, but i don't want the scroll state to be preserved. I want the content to be loaded at the top of the div.

    see the problem in action here:

    http://www.monkeytribe.net/index2.php

    works fine until you scroll down; then the scroll position is preserved for the next content loaded. How to reset the scrollTop?

    i have tried the fix explained here:
    http://www.dynamicdrive.com/forums/a...p/t-11508.html
    but with no luck, the code suggested is still on the "discog" link in the footer, but seems to have no effect...

    i have also experimented with good old fashioned #anchor hrefs, but the javascript does not pass the "#anchor" in "xxx.php#anchor" as discussed here:
    http://www.dynamicdrive.com/forums/s...ad.php?t=20830

    any ideas or fixes will be greatly appreciated!

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Are you talking about in a particular browser here? I just tested your page in FF2 and IE7, and everything seems to work correctly. I tried loading a content that generates scrollbars, scrolled down, then clicked on another link. Either the scrollbar disappears if the content doesn't need it, or if the content needs it, it loads with the scrollbar position back at the very top.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I've answered you in that thread:

    http://www.dynamicdrive.com/forums/s...ad.php?t=11508

    If you need more help with that solution, continue in that thread.

    Anchor links for page scrolling will not generally work in Ajax until after the content has loaded and the page has stabilized with its new code, and only then if they would work on a normal page under the same circumstances and with the same code as the page then has on it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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