EnglishAdam
EnglishAdam

Reputation: 1390

Javascript 'changing' anchor position on screen

Some of my css div heights are being written by javascript when document.ready.

The side effect is that the anchor tag in the page is changing from when the DOM is ready to what then appears on screen after js.

So clicking on the takes you to where it WAS before javascript did its magic.

What work arounds do I have?

EDIT The problem seems to trip up Firefox more than the other browsers. But seeing as I'd like to fix it irrespective of browsers (because anyway the problem is from logic not code - ie the page is actually doing what I've asked it to do!), the solution shouldn't be browser dependent.

Upvotes: 0

Views: 346

Answers (1)

ThiefMaster
ThiefMaster

Reputation: 318518

Use location.hash and a script such as the scrollTo jQuery plugin to scroll to the correct element after your modifications have been done.

Upvotes: 1

Related Questions