hover()与toggle()

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <div id="panel">
        <h5 class="head">什么是jQuery?</h5>
        <div class="content">
            jQuery是javascript库
        </div>
    </div>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //debugger;
            $("#panel h5.head").toggle(
                function () {
                    $(this).next().hide();
                },
                function () {
                    $(this).next().show();
                }
            )
        })
    </script>
</body>
</html>

posted @ 2016-06-28 15:22  Chris_在IT道路上前行  阅读(227)  评论(0编辑  收藏  举报