开发者

Can you execute Fancybox during the page "onUnload" event?

开发者 https://www.devze.com 2023-03-14 05:28 出处:网络
That pretty much sums it up! I\'m trying to use a stylized \"e开发者_开发问答xit popup\" instead of the standard Javascript prompt box. Any advice?This prbably the best you can do:

That pretty much sums it up! I'm trying to use a stylized "e开发者_开发问答xit popup" instead of the standard Javascript prompt box. Any advice?


This prbably the best you can do:

function unload(){
$.fancybox('<div>alalalala<div>', {
    'titlePosition'     : 'inside',
    'transitionIn'      : 'none',
    'transitionOut'     : 'none'
});
}
$(document).ready(function() {
   window.onbeforeunload=function() {
   unload();
   };
});

I think you cannot prevent the page to unload butyou can ask before if user wishes to leave or stay and in the meantime open the fancybox.

K

0

精彩评论

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

关注公众号