我有一个包含在 css 中的黑白图像:
http://cl.ly/3G0E0g1e2G2h3k3U3F2O
在同一个文件中,我放入了彩色图像:
http://cl.ly/1l2A2F0o1j3E1z2s223V
现在我想当你将鼠标悬停在这张图片上时已经从黑白变为彩色......
我把函数放在jQuery中:
$("ul li").mouseover(function() {
$(this).find("span.thumb").hover().css({
'background-position': 'center bottom'
}).stop().fadeTo(400, 0).show();
});
$("ul li").mouseout(function() {
$(this).find("span.thumb").hover().css({
'background-position': 'center top'
}).stop().fadeTo(400, 1).show();
});
HTML:
<span class="thumb"></span>
CSS:
ul li span.thumb {background:url(image.png) no-repeat}
问:我怎样才能做到不同?(当您将鼠标悬停在图像上时不会消失)。