【发布时间】:2009-02-09 14:45:51
【问题描述】:
我已经问过一些关于这个话题的问题,我已经做了一些用户建议的修改,但我仍然无法解决问题。我对 JavaScript 知之甚少,我只是从另一个页面修改了一段代码。
我有这段代码,当鼠标悬停在图像上时,它会动态地将 Div 向上滑动。您可以在此测试页面中查看:cine.uuuq.com
-在 Firefox 中完美运行。
-在 Chrome 中我得到了一些错误的行为。将鼠标悬停在 div 底部附近时,div 会向上滑动。
-在 Internet Explorer 7 中,一切都运行得很慢(有问题),而且 div 的位置也不合适。
jQuery:
jQuery.fn.masque = function(classSelector) {
$(this).hover(function(){
$(this).find(classSelector).stop().animate({height:'90px',opacity: '1'},400);
},function () {
$(this).find(classSelector).stop().animate({height:'0',opacity: '0'}, 300);
});
};
$(document).ready(function(){$('.thumb').masque('.masque');});
HTML:
<div class="thumb bg25">
<a href="#"><img src="img/poster2.jpg" alt="Movie Title" /></a>
<div class="masque">
<h3 class="movietitle"><a href="#" >Movie Title</a></h3>
<p class="movieinfo">2008</p>
<p class="movieinfo">Drama, History, Comedy, Short</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;}
也许有人可以帮我解决这些兼容性问题!谢谢!
【问题讨论】:
标签: jquery cross-browser