Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Accordion in Accordion

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

like image 312
Tyler DeWitt Avatar asked Apr 19 '11 22:04

Tyler DeWitt


People also ask

What is jQuery ui accordion?

jQuery UI Accordian is an expandable and collapsible content holder that is broken into sections and probably looks like tabs. Syntax: You can use the accordion () method in two forms: $(selector, context).

How can we make accordion dynamically using jQuery?

Your append string needs to be terminated with single quotes since you are using double quotes with it. Also you need to include Jquery library. If you are using the jquery accordion you also need to include the Jquery UI library. Also your html is a bit off, here is a working example.

How do I make my accordion active?

$('#accordion'). activate('activate',117);

What is UI accordion?

In web design, an accordion is a type of menu that displays a list of headers stacked on top of one another. When clicked on (or triggered by a keyboard interaction or screen reader), these headers will either reveal or hide associated content.


2 Answers

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

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

like image 125
Naveed Ahmad Avatar answered Oct 20 '22 20:10

Naveed Ahmad


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

like image 44
Pbk1303 Avatar answered Oct 20 '22 20:10

Pbk1303