鼠标移入隐藏,移出显示
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jquery事件</title>
<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
*{padding: 0;margin: 0;}
body{font-size: 12px;padding: 50px;width: 300px;}
#aa{border: 1px solid #999;padding: 5px;width: 300px;}
h5{padding: 5px;cursor: pointer;background: #eee;}
.body{border: 1px solid #999;text-indent:2em;padding: 5px;}
</style>
<script type="text/javascript">
$(function(){
$("h5").hover(function(){
$(".body").hide()
},function(){
$(".body").show()
})
})
</script>
</head>
<body>
<div class="aa">
<h5>Hello jQuery</h5>
<div class="body">
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
</div>
</div>
</body>
</html>