开发者

Open link after script is done with jquery

开发者 https://www.devze.com 2022-12-12 03:23 出处:网络
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 bef

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;
});
0

精彩评论

暂无评论...
验证码 换一张
取 消