最佳答案
用纯CSS你可以做这样的事情
#image_description {
display: none;
background-color : #333;
color : #fff;
padding : 50px;
}
#the_image:hover~#image_description{
display: block;
}
<img src="https://placehold.it/350x150" id="the_image">
<div id="image_description">SomeDescription</div>
使用 jQuery 你可以做这样的事情
$(document).ready(function(){
$("#the_image").hover(function(){
$("#image_description").fadeIn();
}, function(){
$("#image_description").fadeOut();
});
});
#image_description { display : none }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="https://placehold.it/350x150" id="the_image">
<div id="image_description">SomeDescription</div>
关于javascript - 在用户将鼠标悬停在图像上之前隐藏描述?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38066423/