I want that everytime a page is left (unloaded) in my website, a jquery effect is applied to <body>.
This is what I tried:
$(window).unload(function(){
$("body").hide("blind", 2000, function(){alert("bye")});
});
…but with no success. I think what’s happening is jquery doesn’t wait for the effect to be over before it jumps to the next page.
Unload means the page is already unloaded. You can’t put an effect in there, it’ll never run.
You could put your code in the “beforeunload”, in which case it’d probably at least start (maybe, in some browsers), but the page would unload well before it has a chance to perform any sort of animation.