tags:

views:

96

answers:

1

I'm trying to accomplish a transition effect if you will. On doc ready div fades out, the problem im having is when a visitor navigates away from the page (or .unload) I want the div to fade back in.

$(document).ready(function(){

$('#overlay').fadeOut(2000, 'easeOutQuad');

});

$(window).beforeunload(function() {

$('#overlay').fadeIn(2000, 'easeOutQuad');

});

+1  A: 

beforeunload events are unreliable, you cannot make sure they are fully executed, because the differences in unload speeds across browsers and computers. Also, to achieve the fade-in effect, the unload must be delayed, which is not possible.

SHiNKiROU
Thanks for the info, I was playing around with trying to delay the unload but I guess that's not going to work.
Starboy