Open one tab at a time in accordion

后端 未结 2 1240
眼角桃花
眼角桃花 2021-01-23 16:02

I have a accordion which is working absolutely fine but what I need is to open only one tab at a time, means when one tab is opened then another tab should be closed.

Cu

2条回答
  •  死守一世寂寞
    2021-01-23 16:08

    You can also close other accordions by adding a beforeActivate callback:

    $( ".myAccordion" ).accordion({
          collapsible: true,
          active: false,
        heightStyle: "content",
        beforeActivate: function(event, ui) {
       $( ".myAccordion" ).not(this).accordion('option', 'active', false);
    }
    

提交回复
热议问题