Friends! Please help. There is a modal window that opens by reference. What corrections need to be made to it so that this window opens automatically when the page loads, but not immediately, but after eg 60 seconds?

Here is the script code:

jQuery(document).ready(function () { //Set the lightbox position in the center of screen jQuery('.lightbox').css({ position: 'absolute', }); //Show the lightbox with background if the link is clicked jQuery('a.authorization-open').click(function(e) { e.preventDefault(); jQuery('.lightbox').fadeIn(800); jQuery('.authorization-overlay').fadeIn(800); }); //Hide the lightbox and background if the close link or overlay div is clicked jQuery('a.authorization-close').click(function(e) { e.preventDefault(); jQuery('.lightbox').fadeOut(800); jQuery('.authorization-overlay').fadeOut(800); }); }); 

Thank you in advance for your help!

    2 answers 2

    You can try through .delay() :

     var delay = 5; // 5 sec. $('.lightbox').delay(delay * 1000).fadeIn(800); 

    See the result

    • Yes, it works! Thank you very much! God bless you! - LADYX

    Try so

     setTimeout(function(){ jQuery('a.authorization-open').click(); // или jQuery('a.authorization-open').trigger('click'); }, 60000); 
    • I tried, something did not work for me. Maybe I did something wrong. The answer below, through var delay worked immediately. In any case, thank you very much! God bless you! - LADYX