【问题标题】:Shadowbox not working in IEShadowbox 在 IE 中不起作用
【发布时间】:2010-05-06 08:33:39
【问题描述】:

我的 shadowbox 有点问题,它在 FF 中运行良好,但在 IE 7 或 8 中无法运行。

我正在使用这些脚本,

<script type="text/javascript" src="scripts/jquery-1.4.2.js"</script>
<link rel="stylesheet" type="text/css" href="scripts/shadowbox/shadowbox.css">
<script type="text/javascript" src="scripts/shadowbox/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init();
</script>

我也在使用这个 jQuery 将 rel 属性分配给我日历中的所有 a 标签,它在 FF 中可以正常工作,但在 IE 中根本不行。

$(function() {
   $('#wp-calendar').find('a').each( function() {
       $(this).attr( 'rel', 'shadowbox[Mixed];width=520;height=390');
   });
});

但由于某种原因,它只是拒绝在任何 IE 中工作。

我真的在我的绳索尽头,任何帮助将不胜感激,thanx!

【问题讨论】:

    标签: javascript jquery internet-explorer shadowbox


    【解决方案1】:

    您在页面加载时立即调用Shadowbox.init();,但仅在jquery dom:ready 状态下添加rel 参数。

    init() 方法被执行时,Shadowbox 只能拾取已经具有rel=... 参数的链接。

    在某些浏览器中显然首先发生dom:ready 事件,然后执行&lt;script&gt; 中的脚本,但在IE 中不执行。分配 rel 属性后,您应该在 jquery $(function ... 中移动 Shadowbox.init()

    $(function() {
       $('#wp-calendar').find('a').each( function() {
           $(this).attr( 'rel', 'shadowbox[Mixed];width=520;height=390');
       });
       Shadowbox.init();
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-30
      • 2011-07-31
      • 2012-05-16
      相关资源
      最近更新 更多