Shadowbox无法在IE中运行 [英] Shadowbox not working in IE
问题描述
我的影子箱有点问题,它在FF中工作正常,但它拒绝在IE 7或8中工作。
I have a bit of a problem with my shadowbox, it works fine in FF, but it refuses to work in IE 7 or 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属性分配给我日历里面的所有标签,它在FF中工作正常,但在IE中根本不行。
and I am also using this jQuery to assign the rel attribute to all the a tags inside of my calendar, and it works fine in FF, but not at all in IE.
$(function() {
$('#wp-calendar').find('a').each( function() {
$(this).attr( 'rel', 'shadowbox[Mixed];width=520;height=390');
});
});
但由于某种原因,它只是拒绝在任何IE中工作。
but for some reason it just refuses to work in any IE.
我真的在这里结束了,任何帮助都会受到赞赏,感谢x!
I really am at the end of my rope here, any help would be appreciated, thanx!
推荐答案
您正在加载页面时立即调用 Shadowbox.init();
,但仅在jquery dom上添加 rel
参数:准备状态。
You are calling Shadowbox.init();
immediately when page is loading, but adding rel
parameters only on jquery dom:ready state.
当 rel = ...
参数的链接> init()方法已执行。
Shadowbox can pick up only links that already had the rel=...
parameter when init()
method was executed.
在某些浏览器中,显然首先发生 dom:ready
事件,然后是<的脚本;脚本>
已执行,但不在IE中。在分配rel属性后,你应该在jquery $(function ...
)中移动 Shadowbox.init()
:
In some browsers apparently first happens dom:ready
event, and then scripts in <script>
are executed, but not in IE. You should move Shadowbox.init()
inside jquery $(function ...
after assigning rel attribute:
$(function() {
$('#wp-calendar').find('a').each( function() {
$(this).attr( 'rel', 'shadowbox[Mixed];width=520;height=390');
});
Shadowbox.init();
});
这篇关于Shadowbox无法在IE中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!