I'm attempting to create an animation that occurs before the page transitions. After finding a jQuery script on this site and tweaking it to match my HTML, I realized the code works in a fiddle but not on my actual page. Any assistance would be greatly appreciated!
Currently, the page changes without executing any of the script.
UPDATE: I've noticed that when I change #link in the jQuery to "html," it functions properly. However, no other elements seem to work. Strange.
jQuery:
$("#link").click(function(e) {
e.preventDefault();
e.stopPropagation();
$(this).animate({
opacity: 0.25,
}, 5000, function() {
document.location.href = this.href;
});
});
HTML:
<a id="link" href="/page/"></a>