Forum Moderators: open

Message Too Old, No Replies

returning scrollable div to top

         

ctoz

4:00 am on Mar 24, 2008 (gmt 0)

10+ Year Member



I have a series divs containing text: you click on a an external link to put a new text div in the scrolling area, and you can scroll the text. (These divs are not imported , at the moment they're just 'display:none', or 'display:block' when the appropriate link is clicked.)

Problem is, when you click on one link and scroll the div, and then click on another link, the new div appears in the scroll position of the previous one. Been trying to get a div to appear at its top, no matter where the previous div was scrolled to.

Already tried, perhaps not correctly, "location.hash('#top')" with empty anchors named "top"; haven't figured out how to use 'scrollTo'; and, am I right in thinking 'scrollTop' is MSIE only?

[edited by: encyclo at 8:13 pm (utc) on Mar. 24, 2008]
[edit reason] no personal URLs please, see posting guidelines [/edit]

ctoz

10:35 pm on Mar 24, 2008 (gmt 0)

10+ Year Member



solved
document.getElementById(id).style.top='0px';