Chirag
Chirag

Reputation: 1

Automatically close an iframe

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?

Upvotes: 0

Views: 2468

Answers (1)

DJ Tarazona
DJ Tarazona

Reputation: 1789

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

Upvotes: 2

Related Questions