Forum Moderators: open

Message Too Old, No Replies

Scrollbar (overflow) back to start position

Problem after Show/Hide Javascript on Layers

         

Mobull

8:09 pm on Feb 23, 2004 (gmt 0)

10+ Year Member



I'm using a small javascript to show and hide my layers. I have 5 layers on top of eachothers and 5 buttons to simulate a tabbed page.
On the click of one button, that specific topic shows and the others are hided.
However here comes one problem:
When I use divs with: "overflow:auto;" I get a problem when I return to that link (after clicking another): It remembers the scrollbar's position.

So...if I scroll down on the first page...then I click another button, then I return to the first page with that scrollbar, I want the page to be shown from the top again, and not halfway down. Does this makes sense?

Do I need javascript for this, or can I set something in my stylesheet?

[edit] Thanks to Dr. Doc I know I have to use Javascript. Only problem is: how can I do it? I cannot find anything concerning repositioning a layer by javascript.[/edit]

[edited by: Mobull at 9:33 pm (utc) on Feb. 23, 2004]

DrDoc

8:24 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You would have to handle that using JavaScript...
It's not like any data is reloaded... Just hidden and then displayed again (like regular application windows).

Mobull

10:52 am on Feb 24, 2004 (gmt 0)

10+ Year Member



After spenidng way too many hours on the Internet someone of another forum gave me the answer:
<script>
function scrollbarPosition() {
var o = document.getElementById("bar");
o.scrollTop = 0;
}
</script>