Open link after script is done with jquery
I'm trying to make a jquery script that makes the pag开发者_开发技巧e fade out before leaving it. can anyone help?
I think this would be the least obtrusive way. It simply fades out the page just before unload, regardless of whether the unload is caused by F5, navigating to another page, closing the browser window, or clicking a link.
window.onbeforeunload = function() { $(document.body).fadeOut() }
If you just want it for special links, tho, you could try this:
$('a.withFade').live('click', function() {
var url = $(this).attr('href');
$(document.body).fadeOut('1000', function() {
location.href = url;
});
return false;
});
精彩评论