2011-12-28 12 views
1

私はjQueryのアコーディオンメニューでの作業、そして親と子のナビゲーションの問題を発見し、緊急の助けを必要とし、感謝jQueryのアコーディオンの崩壊と課題(親子)を展開し

ています私は1つの親メニューを完全に拡張し、その子をクリックし、見出しをクリックして折りたたむことができます。別の見出しを展開して、最初の見出しをクリックして戻ると、子メニューが折りたたまれていませんでした。別の親見出しを選択すると、ある親のすべての子見出しを折りたたむ方法はありますか?

感謝:)ここ

は私のコードここ

<div id="accordion"> 
    <h3><a>Link One - First Level</a></h3> 
    <div class="accordionSecond">  
     <h6><a href="#">Second Level</a></h6> 
     <div class="accordionLink"> 
     <a href="1.html">1.html</a> 
     <a href="2.html">2.html</a> 
     <a href="3.html">3.html</a> 
     <a href="4.html">4.html</a> 
     </div> 
    </div> 

    <h3><a>Link Two - First Level</a></h3> 
    <div class="accordionSecond">  
     <h6><a href="#">Second Level</a></h6> 
     <div class="accordionLink"> 
     <a href="1.html">1.html</a> 
     <a href="2.html">2.html</a> 
     <a href="3.html">3.html</a> 
     <a href="4.html">4.html</a> 
     </div> 
    </div>  

</div> 

ある小さなスクリプトラインは

<script> 
    $(document).ready(function() { 
    $("#accordion").accordion({active: true, collapsible: true, header: "h3", autoHeight: false, navigation: true, event: 'mouseup'}); 
    $(".accordionSecond").accordion({active: true, collapsible: true, header: "h6", autoHeight: false, navigation: true,event: 'mouseup'}); 
    }); 
    </script> 

答えて

2

であるあなたは、親アコーディオンのchangestartイベントを活用したいと思います。ここでは、任意の子アコーディオンを折りたたむことができます。

$("#accordion").accordion({ 
    active: true, 
    collapsible: true, 
    header: "h3", 
    autoHeight: false, 
    navigation: true, 
    event: 'mouseup', 
    changestart: function (event, ui) { 
     ui.oldContent.accordion("activate", false); 
    } 
}); 

activate方法を使用し、それをfalseを通過するすべてのセクションを折りたたむにアコーディオンを伝えます。

例:http://jsfiddle.net/p2h8V/

+0

感謝の男!!!!私はそれを固定しました、ありがとう、百万。明けましておめでとうございます。 –

+0

私はあなたにもう一つ物事を尋ねることができますか?あなたは一度そのページでリンクを無効にする方法を知っていますか? –

+0

私はその解決策を見つけると思う。 jQuery( "a [href $ = '" +パス+ "']")。removeAttr( 'href'); ヘルプのおかげで、アンドリュー。 –

関連する問題