Monday, May 20, 2024
179
rated 0 times [  182] [ 3]  / answers: 1 / hits: 33220  / 16 Years ago, sat, march 14, 2009, 12:00:00

Using JavaScript, is there a way to update window.location.hash without scrolling the web page?



I have clickable title elements that toggle the visibility of a div directly beneath them. I want the /foo#bar in the history when clicking titles but don't want the page scrolling about. So when navigating away from /foo#bar I'll be able to use the back button and have the div whose ID is in window.location.hash be visible upon return.



Is this behavior possible?


More From » browser-history

 Answers
7

This behavior is very much possible. You should look into some of the libraries that have been developed to give you this functionality.



Really Simple History: http://code.google.com/p/reallysimplehistory/
SWFAddress: http://www.asual.com/swfaddress/


[#99847] Monday, March 9, 2009, 16 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
saiget

Total Points: 64
Total Questions: 105
Total Answers: 105

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
;