1. 程式人生 > >jQuery 2.1.3中的toggle() 有問題

jQuery 2.1.3中的toggle() 有問題

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="../../try/jquery-2.1.3.js"></script>
    <script>
        $(function(){
            $("#panel h5.head").toggle(function(){
                $("div.content").fadeOut();
            },function(){
                $("div.content").fadeIn();
                }
            )
        })
    </script>
    <style>
        .head{
            background-color: #376EA6;
            border: 3px solid #cccccc;
            line-height: 20px;
            width: 300px;
            margin: 20px 20px 0 200px;
        }
        .head+div{
            margin: 0 20px 0 200px;
            width: 300px;
            height: auto;
            border: 3px solid #cccccc;
        }
        .content{display:block;}
    </style>
</head>
<body>
<div id="panel">
    <h5 class="head">古巨基</h5>
    <div class="content">我正在聽你的歌啊,你唱的真好聽,可是你怎麼社得我難過,你卻沒有感動過,愛我別走,如果你說,你沒愛過
        我正在聽你的歌啊,你唱的真好聽,可是你怎麼社得我難過,你卻沒有感動過,愛我別走,如果你說,你沒愛過
        我正在聽你的歌啊,你唱的真好聽,可是你怎麼社得我難過,你卻沒有感動過,愛我別走,如果你說,你沒愛過</div>
</div>
</body>

</html>

以上程式碼在jQuery2.1.3中執行時,顯示自動把“古巨基”淡出,而在jQuery1.3.1中顯示正常!!