0

시작시 아코디언을 기본값으로 닫으려면 어떻게해야합니까?동적 Jquery 아코디언

#accordion div.pane: display:none; 
+0

여기에는'.accordion()'이라는 jQuery UI Accordion이 있습니다. http://jqueryui.com/demos/accordion/ 질문에서 실제로 탭 위젯을 사용하고 있음을 명확히하고 싶을 수도 있습니다. :) –

+0

나는 다음과 같은 샘플의 링크로 다시 게시 한 위젯을 사용하지 않습니다. –

답변

0

당신은 이런 식으로 작업을 수행 할 수 있습니다 :

$("#accordion") 
    .tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide', collapsible: true}) 
    .tabs('select', false); 

이 표시 당신의 CSS에서

<script> 
$(function() { 

$("#accordion").tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide'}); 
}); 
</script> 

<script> 

// add new effect to the tabs 
$.tools.tabs.addEffect("slide", function(i, done) { 

    // 1. upon hiding, the active pane has a ruby background color 
    this.getPanes().slideUp("slow").css({backgroundColor: "#fff"}); 

    // 2. after a pane is revealed, its background is set to its original color (transparent) 
    this.getPanes().eq(i).slideDown("slow", function() { 
     $(this).css({backgroundColor: 'transparent'}); 

     // the supplied callback must be called after the effect has finished its job 
     done.call(); 
    }); 
}); 
</script> 
+0

$ ("# accordion"). tabs ("# accordion div.pane", {tabs : 'h3', accordion : true}) .tabs ('select', false); ; }}); –

+0

이 작동하지 않습니다. $ ("# accordion") 탭 ("# accordion div.pane", 탭 : 'h3', 효과 : '슬라이드', 아코디언 : true)) .tabs , 거짓); ; }}); –

+0

@ kwek-kwek 당신은 축소 형을 놓치고 있습니다 : 그 두 가지의 옵션에서 true : 내 대답에 스크롤 내 대답을 의미합니다. –

0

넣어 : 여기 샘플보기 여기 here

코드입니다 그것은 collapsible으로 표시되고, 표시되지 않는 탭을 선택합니다 (사용)..

+0

도 작동하지 않았습니다. –