【发布时间】:2012-03-02 18:10:58
【问题描述】:
我已经在几个应用程序中使用了这个 jquery,这些应用程序基本上是用淡入淡出的过渡进行 img 交换。超级简单
$(document).ready(function() {
$("img.a").hover(
function() {
$(this).stop().animate({
"opacity": "0"
}, "fast");
}, function() {
$(this).stop().animate({
"opacity": "1"
}, "fast");
});
});
用 HTML 标记这个
<div id="leftBox" class="fadehover inline">
<img src="images/leftTop.jpg" alt="" class="a" />
<img src="images/leftBot.jpg" alt="" class="b" />
</div>
CSS
/*fadeHover*/
div.fadehover {
position: relative;
}
img.a {
position: absolute;
left: 0;
top: 0;
z-index: 10;
}
img.b {
position: absolute;
left: 0;
top: 0;
}
我想知道这是否可以应用于背景图像?
我正在尝试在样式标签中做到这一点,但没有任何运气。
谢谢
【问题讨论】: