hover()方法

node2:/var/www/html/jquery#cat t40.html
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #panel{
             400px;height: 100%;border: 1px solid #ddd;margin: 0;padding: 0px;margin-left: 200px;margin-top: 20px;
        }
        .head{
            background: #aaa;padding: 10px;margin: 0;color: #000;
        }
        .content{
            padding: 10px;text-align: left;text-indent: 2em;display: none;
        }
    </style>
    
</head>
<body>
    <div id="panel">
        <h5 class="head">什么是jQuery?</h5>
        <div class="content">
            我是小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本,小文本
        </div>
    </div>
<script type="text/javascript" src="jquery-1.2.3.min.js"></script>    
<script type="text/javascript" src="t40.js"></script>
node2:/var/www/html/jquery#
node2:/var/www/html/jquery#cat t40.js

$(function(){
  $("#panel h5.head").hover(function(){
     $(this).next("div.content").show();
},function(){
     $(this).next("div.content").hide();
});
});
原文地址:https://www.cnblogs.com/hzcya1995/p/13348775.html