How to make hyperlink change text in overflow:hidden div without jumping to the div

Posted by paracaudex on Stack Overflow See other posts from Stack Overflow or by paracaudex
Published on 2010-03-25T17:44:21Z Indexed on 2010/03/25 18:03 UTC
Read the original article Hit count: 418

Filed under:

I have a div element with fixed height and width and overflow:hidden, and I have a menu that causes this div to scroll to anchors in the text within the div. However, when you click on an item on this menu, it doesn't just scroll the div, it also scrolls the page to the div. How do I prevent this second from happening. That is, I just want the div to scroll without the page itself scrolling.

So I have
<div id="boxcontent">
<p id="id1">Some content</p>
<p id="id2">Some content</p>
<p id="id3">Some content</p>

boxcontent { width:600px; height:180px; overflow:hidden; margin-left:auto; margin-right:auto; }

And then a ul with anchor links to id1, id2, etc.

Does this make sense?

© Stack Overflow or respective owner

Related posts about div

Related posts about overflow