用jQuery完成照片高亮显现
方法一:
获取每一个包裹img图片的div(.img),用this完成
var $img = $(document.getElementsByClassName("img"));
$img.mousemove(function(){
$(this).css("opacity","1");
$(this).siblings(".img").css("opacity","0.3");
})
$(".box").mouseout(function(){
$(".box>.img").css("opacity","1");
})
方法二:
使用jQuery中的hover属性完成
$(".box").mouseover(function(event){
$(".box>.img").css("opacity","0.3");
$(".box>.img:hover").css("opacity","1");
})
$(".box").mouseout(function(){
$(".box>.img").css("opacity","1");
})