Q:

Searched / Tried a lot: Unable to add popup display delay

[Note: I am not programming expert.]
I tried a lot and searched this platform but did not find any solution.
I need to add 30sec delay in displaying a popup box. I took script from here. The script has fade-out time and it is working fine.
Check script below...i replaced 'close()' with 'delay()'. it is not working.
<script type="text/javascript">

$(document).ready(function() {
    if($.cookie('the_cookie') != 1) { // If the_cookie not set to 1 then initializes and play calling the popup
        $.cookie('the_cookie', '1', { expires: 1 }); // Value day (s) before expiration of the cookie

        $.fancybox(
             $("#popup").html(),
             {
                type : 'iframe',
                href : '/contact.php', // url vers notre page html qui sera charg?e dans la popup en mode iframe
                maxWidth : 415,
                maxHeight : 475,
                fitToView : false,
                width : '90%',
                height : '95%',
                autoSize : false

        }
        );setTimeout(function(){ $.fancybox.delay(30000) },10000);

    }
});

A:

try below code,
  $(document).ready(function() {
        if($.cookie('the_cookie') != 1) { // Si the_cookie n'a pas pour valeur 1 alors on l'initialise et on joue l'appel de la popup
            $.cookie('the_cookie', '1', { expires: 1 }); // valeur en jour avant expiration du cookie

        //below 3000 is 3 sec delay then popup appears. 
            setTimeout(fire, 3000); 
       //below 5000 is 5 sec dely after that popup closes. 
            setTimeout("parent.$.fancybox.close()", 5000); 
        }
    });

    function fire() {
    $.fancybox(
                 $("#popup").html(),
                 {
                    type : 'iframe',
                    href : 'http://www.site-web-creation.net/source/pub.html', // url vers notre page html qui sera chargée dans la popup en mode iframe
                    maxWidth : 800,
                    maxHeight : 300,
                    fitToView : false,
                    width : '70%',
                    height : '70%',
                    autoSize : false

            }
            );

    }

i hope this helps to clear your problem. change according your need for delays. i just set timer to fire an event in this case popup box using function fire.

