繁体   English   中英

如何延迟打开Colorbox iframe弹出窗口?

[英]How to delay opening of Colorbox iframe popup?

如何向iframe的colorbox弹出窗口添加延迟(例如2秒)

这是我的js,它是基于cookie的

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

谢谢

尝试这个

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM