【发布时间】:2009-02-08 21:18:58
【问题描述】:
我有这段代码,当鼠标悬停在图像上时,它会动态地将 Div 向上滑动。它在 Firefox 和 Google Chrome 中完美运行,但在 Internet Explorer 7 中,一切运行非常缓慢,什么也没有发生。
jquery 代码是这样的:
jQuery.fn.masque = function(class) {
$(this).hover(function(){
$(this).find(class).stop().animate({height:'100px',opacity: '0.9'},400);
},function () {
$(this).find(class).stop().animate({height:'0',opacity: '0'}, 300);
});
}
$(document).ready(function(){$('.thumb').masque('.masque');});
HTML:
<div class="thumb bg25">
<a href="#"><img src="img/image.jpg" alt="Something" /></a>
<div class="masque">
<h3 class="someclass"><a href="#" >Some text here</a></h3>
<p class="someclass">Some text here</p>
<p class="someclass">Some text here</p>
</div>
</div>
这是 CSS:
.thumb {float:left; margin:0 14px 14px 0; width:126px; height:186px; padding:10px; position:relative;}
.masque{position:absolute; background:#212326; width:118px; bottom:10px; height:0; padding:4px; display:none;}
我是在本地机器上运行它,而不是在服务器上。
.. 所以我认为我做错了什么,也许有一种有效的方法可以实现这种效果。 谢谢!!!
【问题讨论】:
-
如果您需要这里是 CSS:.thumb {float:left;边距:0 14px 14px 0;宽度:126px;高度:186px;填充:10px;位置:相对;} .masque {位置:绝对;背景:#212326;宽度:118px;底部:10px;高度:0;填充:4px;显示:无;}
-
@Jonathan - 最好编辑您的问题并在代码块中添加 CSS :)
标签: javascript jquery internet-explorer cross-browser