I use some hashes in a script to scroll to differents elements of a page when the client open a page that has a trailing "#something" in its url. The problem is when the user uses the go back and for buttons of his client. How can i make the script reacting again once the client has moved back or for?
Here is the concerned portion of code:
// Arrivée avec une ancre
var $h = window.location.hash;
if ($h != '') {
var $arrh = {'#home': '#panel_home', '#services': '#panel_services', '#realisations': '#panel_realisations', '#contact': '#panel_contact', '#about': '#panel_about' };
$('#left').scrollTo($arrh[$h], 500);
}
else {
$('#left').scrollTo('#panel_home', 500);
}
I hope my question is understandable... i'm french and i've just tried to explain my thought the best i can in english.
I don't know if what i'm asking is possible, but if you have an idea, your help will be welcome!
Edit-0:
've just seen a seemingly similar discussion there: Detecting Back Button/Hash Change in URL I'll read and bring back answers if i find a solution (some links proposed are really interesting).