Posted By

magicrebirth on 07/03/10


Tagged

jquery accordion


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hsousa


JQuery Accordion: retrieve active tab / open dynamically


 / Published in: JavaScript
 

URL: http://jqueryui.com/demos/accordion/#method-activate

  1. // imagine the accordion is started like this:
  2. $("#accordion").accordion({ header: 'h5', collapsible: true , active: false});
  3.  
  4.  
  5. // this gets you the index of open accordion [0.....n]
  6. $("#accordion h5").index($("#accordion h5.ui-state-active"));
  7.  
  8. // let's save that index.. and use it to activate/deactivate the tab
  9. n = $("#accordion h5").index($("#accordion h5.ui-state-active"));
  10. $('#accordion').accordion('activate', n);

Report this snippet  

You need to login to post a comment.