提交 | 用户 | 时间
|
58d006
|
1 |
/** |
A |
2 |
<b>Wizard</b>. A wrapper for FuelUX wizard element. |
|
3 |
It's just a wrapper so you still need to include FuelUX wizard script first. |
|
4 |
*/ |
|
5 |
(function($ , undefined) { |
|
6 |
$.fn.aceWizard = $.fn.ace_wizard = function(options) { |
|
7 |
|
|
8 |
this.each(function() { |
|
9 |
var $this = $(this); |
|
10 |
$this.wizard(); |
|
11 |
|
|
12 |
if(ace.vars['old_ie']) $this.find('ul.steps > li').last().addClass('last-child'); |
|
13 |
|
|
14 |
var buttons = (options && options['buttons']) ? $(options['buttons']) : $this.siblings('.wizard-actions').eq(0); |
|
15 |
var $wizard = $this.data('fu.wizard'); |
|
16 |
$wizard.$prevBtn.remove(); |
|
17 |
$wizard.$nextBtn.remove(); |
|
18 |
|
|
19 |
$wizard.$prevBtn = buttons.find('.btn-prev').eq(0).on(ace.click_event, function(){ |
|
20 |
$wizard.previous(); |
|
21 |
}).attr('disabled', 'disabled'); |
|
22 |
$wizard.$nextBtn = buttons.find('.btn-next').eq(0).on(ace.click_event, function(){ |
|
23 |
$wizard.next(); |
|
24 |
}).removeAttr('disabled'); |
|
25 |
$wizard.nextText = $wizard.$nextBtn.text(); |
|
26 |
|
|
27 |
var step = options && ((options.selectedItem && options.selectedItem.step) || options.step); |
|
28 |
if(step) { |
|
29 |
$wizard.currentStep = step; |
|
30 |
$wizard.setState(); |
|
31 |
} |
|
32 |
}); |
|
33 |
|
|
34 |
return this; |
|
35 |
} |
|
36 |
|
|
37 |
})(window.jQuery); |