我已经包含在CSS黑白图像:jQuery的 - 黑白图像的彩色图像(悬停)
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}
问:我可以做不同呢? (当你将鼠标悬停在图像上时不会消失)。
你也可能想看看进入[jQuery的插件,去色(http://plugins.jquery.com/project/desaturate),它可以从一张彩色图像上即时执行此操作。 – 2011-04-12 10:25:35