为什么 Firefox 3.6 改变了 jQuery 和 CSS 属性?
好吧,更具体一点。我有一个交叉淡入淡出插件,可以在放置在彼此之上的两个图像之间创建发光效果。该函数(如下所示)将使顶部图像在悬停时在 200 毫秒内转换为不透明度 0,并在悬停时在 500 毫秒内转换回不透明度 1。我的问题是原始图像现在在 Firefox 3.6.6 中不显示。
HTML 看起来像这样:
<div id="logout-button">
<img class="fade" src='/img/test/control-logout.jpg' style="background:url(/img/test/control-logout-hover.jpg); border:none;"/>
</div>
CSS 看起来像这样:
#control-bar #logout-button{
float:right;
margin:3px 30px 0 0;
}
#logout-button img.fade{
margin:-1px 0 0 0;
width:33px;
height:22px;
cursor:pointer;
border:none;
}
jQuery 函数页面如下所示:
$(window).bind('load', function(){
$("img.fade").crossfade();
});
jQuery Crossfade 插件如下所示:
$.fn.crossfade = function(){
return this.each(function(){
var $$ = $(this);
var target = $$.css('backgroundImage').replace(/^url|[\(\)]/g, '');
$$.wrap('<span style="position: relative;"></span>').parent().prepend('<img>').find(':first-child').attr('src', target).css({border:'none'});
if(jQuery.browser.msie){
$$.css({position:'absolute', left:0, top:'0px', border:'none'});
}else{
$$.css({position:'absolute', left:0, top:'-6px', border:'none'});
};
$$.hover(function(){
$$.stop().animate({opacity: 0}, 200);
}, function(){
$$.stop().animate({opacity: 1}, 500);
}, 0);
});
};