[英]Hide image when hovering another image
我似乎无法正常工作,所以不知道是否可能
当我将鼠标悬停在img.helmet上时,我希望img.icon被隐藏
<img class="helmet" src="">
<img class="mini" src="">
<img class="helmet" src="">
<img class="mini" src="">
<img class="icon" src="">
这是我的jsfiddle尝试-http: //jsfiddle.net/8wrbL/28/
.helmet:hover > .icon,.helmet:hover + .icon {
display:none;z-index:-999999;left:-999999;
}
更新:看来这可行,但是对于一个简单的任务来说似乎很多css,我将拥有很多图像,这种方式可能需要一些时间
.helmet:hover+.mini+.icon,.helmet:hover+.mini+.helmet+.mini+.icon,.helmet:hover+.mini+.helmet+.mini+.helmet+.mini+.icon{
display:none;
}
尝试使用jQuery定位它,并使用该类作为隐藏它的方法。
jQuery的
$('.helmet').hover(function () {
$('.icon').toggleClass('hidden');
});
CSS
.icon.hidden {
display: none;
}
或者,您只是使用Jquery的隐藏和显示:: http://www.w3schools.com/jquery/jquery_hide_show.asp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.