Javascript jQuery-与Internet Explorer 7的兼容性问题?
我有一段代码,当鼠标移到图像上时,它会在图像上动态地向上滑动一个Div。它在Firefox和GoogleChrome中运行得很好,但在InternetExplorer7中,一切都运行得很慢,什么也没发生 jquery代码如下所示:Javascript jQuery-与Internet Explorer 7的兼容性问题?,javascript,jquery,internet-explorer,cross-browser,Javascript,Jquery,Internet Explorer,Cross Browser,我有一段代码,当鼠标移到图像上时,它会在图像上动态地向上滑动一个Div。它在Firefox和GoogleChrome中运行得很好,但在InternetExplorer7中,一切都运行得很慢,什么也没发生 jquery代码如下所示: jQuery.fn.masque = function(class) { $(this).hover(function(){ $(this).find(class).stop().animate({height:'100px',opacity: '0.9'},400
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>
一,;我在本地机器上运行它,而不是在服务器上
。。所以我认为我做错了什么,也许有一个有效的方法来达到这个效果。
谢谢 你试过把止损开关关掉吗?我完全是在黑暗中拍摄的,但我认为IE7可能会以不同的方式处理通话。我现在来测试一下 更新 测试之后,由于名为class的变量,IE7中出现了一些wierd错误。那一定是某种关键词。试试这个
jQuery.fn.masque = function(classSelector) {
$(this).hover(function(){
$(this).find(classSelector).stop().animate({height:'100px',opacity: '0.9'},400);
},function () {
$(this).find(classSelector).stop().animate({height:'0',opacity: '0'}, 300);
});
};
更新
您是否尝试过使用slideUp和slideDown
jQuery.fn.masque = function(classSelector) {
$(this).hover(function(){
$(this).find(classSelector).slideDown();
},function () {
$(this).find(classSelector).slideUp();
});
};
谢谢如果您需要,这里是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;}BTW,以后不要在评论中添加css,而是在你的帖子中添加。谢谢,现在我看到div在IE7中向上滑动,但它仍然很慢,位置不好而且有问题。。。也许有更好的编码方法?顺便说一句,这是我从www.foliostars.net复制的代码,我修改了它。。。所以我不太明白jQuery…你的图片有多大。如果你需要的话,这里是CSS:{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;}@Jonathan-最好编辑您的问题并在代码块中添加CSS:)
jQuery.fn.masque = function(classSelector) {
$(this).hover(function(){
$(this).find(classSelector).slideDown();
},function () {
$(this).find(classSelector).slideUp();
});
};