I\'m working with jQuery to have a fade-in effect on my html page, which works just fine. However, when I hit the back-button in my browser, I go to the right url but get a
In the function above, the linkLocation variable is no longer available because it is out of scope.
Try this instead:
$("body").css("display", "none");
$("body").fadeIn(1500);
$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(500, function() {
window.location = linkLocation;
});
});
Edit: So I fixed your code, but that wasn't the question. :)
Apparently, the jQuery(document).ready() isn't fired when you hit the back button. You can try this near the top of the page.
history.navigationMode = 'compatible';
Source: Is there a cross-browser onload event when clicking the back button?