views:

39

answers:

2

hi i am trying to make a wizard for first time i want to disable all accordion tabs when i click on the link it enable next tab and open it.. i hve this code but it disable all tabs :( thanks

$(function() {
   $("#list1a").accordion({
    autoHeight: false,
    navigation: false
   });
});
$("#list1a").accordion("disable"); 
$("#list1a").accordion("activate", 2 ); 
A: 

Don't use the accordion for that, it's not intended for wizardry. And since there's no wizard component available in jquery UI, lets make our own ;)

html:

<ul class="ui-wizard">
   <li class="ui-wizard-panel">
      <h3 class="ui-wizard-header">panel 1</h3>
      <div class="ui-wizard-content">
          Panel content
          <span class="ui-wizard-next">Goto next</span>
      </div>
   </li>
   <li class="ui-wizard-panel">
      <h3 class="ui-wizard-header">panel 1</h3>
      <div class="ui-wizard-content">
          Panel content
          <span class="ui-wizard-next">Goto next</span>
      </div>
   </li>
</ul>

javascript plugin:

$.fn.wizard = function(){
   this.find('.ui-wizard-content').hide();
   this.find('.ui-wizard-content:first').show();
   this.find('.ui-wizard-content:last .ui-wizard-next').hide(); // just in case
   this.delegate('.ui-wizard-next', 'click', function(){
      // very long jquery chain...
      $(this).closest('.ui-wizard-content')
             .hide('fast')
             .closest('.ui-wizard-panel')
             .next()
             .find('.ui-wizard-content')
             .show('fast');
   });
}

javascript impl:

$(.ui-wizard).wizard();

Ofcourse.. you'd have to theme it yourself, though copy/pasting and renaming accordion styles gets you a long way. A nicer way would be to make an official wizard widget out of this.

BGerrissen
A: 

Can also check out this code: http://github.com/desdev/jWizard/ Think it's exactly what you need.

BGerrissen