I开发者_开发问答 am currently using FancyBox (http://fancybox.net/) to display a page on my website. It works amazing and as it should but I want it to close automatically as soon as X number of seconds pass. Is there a way I can do that?
Javascript
setTimeout("$.fancybox.close();", 5000); // 5000 milliseconds = 5 seconds
Code to add to your FancyBox options
onComplete: function() { setTimeout("$.fancybox.close();", 5000); }
Example
$("SELECTOR").fancybox({
'type': 'iframe',
onComplete: function() { setTimeout("$.fancybox.close();", 5000); }
});
精彩评论