Forum Moderators: open
The divission which holds the next has an overflow: auto, so the user can scroll the text.
Now, The problem:
If a user clicks on an image it opens perfectly at the left divission but if the user scroll the text for reading and after he clicks on a second image then the the new text loads perfectly but the scroll conserves its position so you have to scroll up to see the beginning of the text.
this is the link on the image:
<a href="javascript:showScoop('4')"><img src="../images/scoop/Scoop4Thumb.jpg"/></a>
I tried adding an anchor at the top of my text and do this
<a href="javascript:showScoop('4'); #top"><img src="../images/scoop/Scoop4Thumb.jpg"/></a>
but that doesnt work, i was not expecting something different but I had to try I coudnt help it.
Can somebody tell me how can i load my text and reset the scroll position so the new text loaded starts from the top?
thanks in advance.
...load my text and reset the scroll position...
I think you are heading in the right direction... I believe you can reset the scroll position of the container in JavaScript using the elements .scrollTop method (although it's not part of the W3C spec and I'm not sure about browser compatibility but should be OK in FF and IE)?
Something like:
element.scrollTop = 0;
Mozilla - DOM:element.scrollTop [developer.mozilla.org]
...what Im most worried about is IE6
.scrollTop is certianly supported in IE6. I think it was introduced in IE4. How it behaves on certain elements may have varied. The DOCTYPE can play a part. As I understand it,
overflowneeds to be set, which you are doing anyway.
MSDN: scrollTop Property [msdn.microsoft.com]