Question

I am using jQuery accordion. I want to set accordion as expanded or collapsed dinamically.

For this I wrote this:

<script type="text/javascript">
    $(function() {
        $( "#_title_${sec_id}_id" ).accordion({
         active: ${open},
          collapsible: true,
          heightStyle: "content"          
        });
      });
</script>

But if ${open} is true accordions are collapsed, and if ${open} is false they are collapsed again.

Is this a bug Or I am mistaken somewhere?

Is there a solution?

Was it helpful?

Solution

As per accordion api active is meant for "Which panel is currently open." , it takes false (to collapse all) or other options are numeric like 1, 2 to active either the first or second respectively

Logically it will not be a bug because as accordion is meant to collapse the menu. You can post to their forum for better clarification

I tried using active: false/true but they both behave the same. http://jsfiddle.net/raunakkathuria/sc7uL/1/

See this blog for explanation regarding this http://forum.jquery.com/topic/expand-all-zones-for-an-accordion

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top