Question

How would I add a delay (e.g 2 seconds) to my colorbox popup of an iframe

Here's my js, which is cookie-based

if (document.cookie.indexOf('colorframe=true') === -1) {
var expires = new Date();
expires.setDate(expires.getDate()+1);
document.cookie = "colorframe=true; escKey=true; expires="+expires.toUTCString();

(function($){
    $(document).ready(function() {
       $.colorbox({escKey:true,innerWidth:475,innerHeight:470,html:'<iframe width=475 height=470 src=http://www.mysite.com/popup-page frameborder=0 border=0 allowfullscreen></iframe>'});
    });
  }(jQuery)
)};

Thanks

Was it helpful?

Solution

try this

 setTimeout(function () {
     $.colorbox({
         escKey: true,
         innerWidth: 475,
         innerHeight: 470,
         html: '<iframe width=475 height=470 src=http://www.mysite.com/popup-page frameborder=0 border=0 allowfullscreen></iframe>'
     });
 }, 2000);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top