【发布时间】:2011-11-24 15:40:35
【问题描述】:
我有这个功能:
jQuery.fn.getParent = function(num) {
var last = this[0];
for (var i = 0; i < num; i++) {
last = last.parentNode;
}
return jQuery(last);
};
还有这个html:
<div class="statuscontainer">
<div class="title">
Title of div here
</div>
blah blah blah blah <br>
<a onclick="$(this).getParent(4).fadeTo("slow",.3);">fade only this div</a>
</div>
<div class="statuscontainer">
<div class="title">
Title of div here
</div>
blah blah blah blah <br>
<a onclick="$(this).getParent(4).fadeTo("slow",.3);">fade only this div</a>
</div>
我想要的是,每个链接都应该淡出它的主要状态容器 div 而不是所有其他 div,这是使用 jQuery GetParent 完成的。
这在 firefox/chrome/safari 中效果很好,但在 IE 7/8 中,只有 blah blah blah 和链接会褪色,而不是整个“statuscontainer”。
你有什么建议?
谢谢
【问题讨论】:
标签: javascript jquery html css cross-browser