views:

61

answers:

2

I want to automatically close a fancybox iframe, but I want to give it a delay.

$(document).ready(function() {
 parent.$.fancybox.close();
});

The code above will automatically close the window successfully, but I want to add a delay, so they may read the message the page displays before it auto closes for them.

A: 

If you are using jquery 1.4 try the delay() function:

parent.$.fancybox.delay(2000).close();

aletzo
+1  A: 

You can use setTimeout:

setTimeout("parent.$.fancybox.close()", 1000);
karim79