Creative Jar Blog RSS Feed

Scrolling div and anchor links

March 18, 2008 12:32 by rob

I've just hit a browser difference that stopped me for a while!

My problem:

Text links outside a scolling div to jump the scroll view to the desired location within the scrolling div.
The scrolling div has the css overflow:auto; with a set height to enable scrolling.
Using normal anchor links and names worked for firefox but not IE6 + IE7, after researching on the net I came across a javascript equivalent.

document.getElementById('elmID').scrollIntoView(true);

Using this javascript and adding ID's to the areas I needed for scroll view worked a treat! 


Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Comments

February 19. 2009 04:36

Reading this post and trying to modify it for my situation. I wonder if you would help.
I have multiple divs which I fill using ajax. Above each one is a menu of links to anchors in that div. Each menu should scroll only its own div.

Your code works but all links affect only the first div. Is there a way to identify both div and anchor (by their ids) using your code?

Thanks for any help you can provide,
Lev

Lev

August 14. 2009 16:40

I don't which div to put it in but thanks for the post. I'll just have to figure out myself.

Data entry services

Calendar

March 2010
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910