jQuery UI Accordion in Accordion

2020-07-06 05:51发布

问题:

Is it possible to have an accordion embedded in another accordion with jQuery UI?

-Item One
-Item Two
-Item Three
  --Sub One
  --Sub Two
  --Sub Three
-Item Four

Where Sub One through Four is another accordion.

Thanks

回答1:

Give each container that you want to make an accordion a class like accordion and use:

$(".accordion").accordion();



回答2:

Just give different id names for each accordion and call them in the jquery function an you would have to edit the css to get the desired look though.

$(function() {
    $( "#accordion,#accordion2" ).accordion();
  });

DEMO