Jquery accordion, next and previous wizard, how to get previous and next sections?

Posted by Wbdvlpr on Stack Overflow See other posts from Stack Overflow or by Wbdvlpr
Published on 2009-09-13T16:51:41Z Indexed on 2010/06/07 23:52 UTC
Read the original article Hit count: 155

Filed under:
|
|

Hi

I have a Jquery accordion which works fine. Sections get expanded/collapsed when clicked on respective headers. But I want to add the functionality so that when I click on "next" button it opens up the next section and clicking "Previous" button takes me back to previous section.

This has been done on this page http://jquery.bassistance.de/accordion/demo/?p=1.1.2 (last example) but not sure how do I implement the same in my case.

Any suggestions please.

Thanks

UPDATE: How do I get previous or next section of the accordion?

<script type="text/javascript">
 $("#accordion").accordion({ 
   header: "h3.header"
   , autoHeight: false
   , collapsible: true
  });
</script>

<div id="accordion">
 <h3 class="header">Section 1</h3>
 <div> content 1 .. content 1 .. content 1 .. content 1 ..
  <input class="next" type="button" value="next"/>   
 </div>
 <h3 class="header">Section 2</h3>
 <div> content 2 .. content 2 .. content 2 .. content 2 ..
  <input class="previous" type="button" value="previous"/>
  <input class="next" type="button" value="next"/>   
 </div>
 <h3 class="header">Section 3</h3>
 <div> content 3 .. content 3 .. content 3 .. content 3 ..
  <input class="previous" type="button" value="previous"/>
 </div> 
</div>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery