【问题标题】:How to delay opening of Colorbox iframe popup?如何延迟打开 Colorbox iframe 弹出窗口?
【发布时间】:2013-12-26 14:42:30
【问题描述】:

如何在 iframe 的颜色框弹出窗口中添加延迟(例如 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)
)};

谢谢

【问题讨论】:

    标签: javascript jquery iframe colorbox


    【解决方案1】:

    试试这个

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

    【讨论】:

    • 太棒了。非常感谢。我只是少了一个分号。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多