troubleshooting Question

Using Javascript to scroll to specific html element

Avatar of uhm179
uhm179 asked on
7 Comments1 Solution1647 ViewsLast Modified:

I am trying to implement unique URLs in my ajax application and so far so good.
Unfortunately, since the technique uses the fragment identifier '#' in the URL, I can no longer use it jumping to anchors.
(btw, The technique I'm using is actually just the new HistoryPoint feature in ASP.NET 3.5)

So I need to simulate the action of jumping to an anchor.
Lets say I have an element somewhere down the html page (a table cell for instance), and I have its id.
The browser obviously knows how to jump to an anchor, so how can i do it via javascript without actually using a fragment identifier.
(I've already tried to see whether i could retrieve the absolute pixel position of the element and then scroll to te appropriate place, but there is no such method for retrieving absolute pixel position).
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros