我正在寻找的脚本工作喜欢Dribbble (当你的鼠标悬停在上面时出现覆盖)。但它必须是多个...我的意思是用于网站上的许多图片。就这么简单。
谢谢!
发布于 2011-07-01 05:38:18
使用jQuery和hover()鼠标事件,你可以实现你想要的行为。
$("img").hover(function() { //select the image which is hovered
$(this).css("opacity","0.5"); //apply opacity for this image
}, function() {
$(this).css("opacity","1"); //change to opacity to default
});演示: http://jsfiddle.net/mVWdQ/
对于selector,您可以使用仅用于所需镜像的class,而不是作为img的element。
另一种方法是使用animate()。
$("img").hover(function() {
$(this).animate({opacity:0.5},500);
}, function() {
$(this).animate({opacity:1},500);
});演示: http://jsfiddle.net/mVWdQ/1/
https://stackoverflow.com/questions/6541309
复制相似问题