Browser history back with scrollable div

Posted by plink on Stack Overflow See other posts from Stack Overflow or by plink
Published on 2010-03-17T07:33:57Z Indexed on 2010/03/17 7:41 UTC
Read the original article Hit count: 381

Filed under:
|
|
|

When I Jump to section 1 & 2 everything works fine, and the browsers I tested (IE8, FF3.6, Chrome 5.0.342.3) scrolls down to the respective anchor in the div. But when I press the browser history back button the div won't scroll back up.

Is there some way to make this work without using javascript ?

<div id="scrolldiv" style="overflow:auto; width:500px; height:500px; border:2px solid #e1e1e1; "> 
<a href="#link1">Jump to section 1</a> <br />
<a href="#link2">Jump to section 2</a> <br />

<h1 id="link1" name="link1"> (and/or <a name="link1"></a> ) Section 1</h1> 
<p>lots of text<br />lots of text<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p> 

<h1 id="link2" name="link2"> (and/or <a name="link1"></a> ) Section 2</h1> 
<p>lots of text<br />lots of text<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p> 

© Stack Overflow or respective owner

Related posts about html

Related posts about anchor