jQuery does not fire when changing the anchor link in the URL... How can I
capture this event?
I have a page with accordeon-type subsections which are toggled open by
clicking on the section title or by clicking a link from a dropdown in the
global site navigation.
The intention is to make sections within the page accessible directly from
anywhere.
The global menu has links in the format of
/pagename.aspx#anchor-name
/pagename.aspx#anchor-name2
To capture clicks via the global navigation, I use
var anchor = window.location.hash;
if (anchor) {
toggle_element(anchor_name);
}
within
$(document).ready
Unfortunately .ready fires only the first time the page is loaded.
If I navigate to click on /pagename.aspx#anchor-name, my script runs. If I
then click on /pagename.aspx#anchor-name2, nothing happens.
How can I capture this activity?
No comments:
Post a Comment