简体   繁体   English

CSS或jQuery-将鼠标悬停在一个div上,另一个div消失或不显示

[英]css or jquery - hover over one div, another div fades or no display

See http://jasondaydesign.com/masonry_demo/ 参见http://jasondaydesign.com/masonry_demo/

I have title divs that overlay the underlying box div. 我有覆盖基础框div的标题div。

What I am trying to accomplish is when the mouse hovers over the .box div, the div holding the title will either fade out with jquery or just display:none through css. 我要完成的工作是,当鼠标悬停在.box div上时,带有标题的div将通过jquery淡出或仅通过CSS显示:none。

You need to call .hover() , like this: (tested) 您需要像下面这样调用.hover() :(已测试)

$('.box:has(div)').hover(
    function() { $(this).find('div').fadeOut(); },
    function() { $(this).find('div').fadeIn(); }
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM