My problem is best described with this screencast I recorded: http://www.youtube.com/watch?v=aI-p_jqzOdU
I'm using the jQuery Address plugin for Ajax deep-linking. For those who don't know how jQuery address works, it works by listening to the hash changes with the change()
method. Pressing the back button and pressing a hyperlink that goes to the previous page URL should behave the same way because they call the same event handler.
Here it is in pseudo code:
$address.change(function(event) {
if (event.value != '/') { // is the image link
Get the URL to be loaded
Create an overlay, append it to body and set its height, width, opacity
Put overlay on top of gallery
Load URL into overlay then fade it in
Set BODY to overflow: hidden
} else { // is the gallery link
Set BODY to overflow: auto
Fade out overlay then remove it
}
});
If you watch the video, you'll see that pressing the link to the previous page causes the scroll of the page to jump back to 0. Pressing the browser back button keeps it which the the desired behavior.
What could be wrong?