jquery.wizard.js 838 B

123456789101112131415161718192021222324252627282930313233
  1. (function($ , undefined) {
  2. $.fn.ht_wizard = function(options) {
  3. this.each(function() {
  4. var $this = $(this);
  5. $this.wizard();
  6. var buttons = $this.siblings('.wizard-actions').eq(0);
  7. var $wizard = $this.data('wizard');
  8. $wizard.$prevBtn.remove();
  9. $wizard.$nextBtn.remove();
  10. $wizard.$prevBtn = buttons.find('.btn-prev').eq(0).on('click', function(){
  11. $wizard.previous();
  12. }).attr('disabled', 'disabled');
  13. $wizard.$nextBtn = buttons.find('.btn-next').eq(0).on('click', function(){
  14. $wizard.next();
  15. }).removeAttr('disabled');
  16. $wizard.nextText = $wizard.$nextBtn.text();
  17. var step = options && ((options.selectedItem && options.selectedItem.step) || options.step);
  18. if(step) {
  19. $wizard.currentStep = step;
  20. $wizard.setState();
  21. }
  22. });
  23. return this;
  24. }
  25. })(window.jQuery);