Can you execute Fancybox during the page "onUnload" event?
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
精彩评论