开发者

Automatically close an iframe

开发者 https://www.devze.com 2023-01-23 02:37 出处:网络
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 secon

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

精彩评论

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

关注公众号