我使用的是IE8和jquery智能向导3.2.0版。我注意到,当将智能向导封装在额外的<div>标记中(意图在jquery对话框弹出窗口中显示向导)时,当为onLeaveStep事件指定函数时,向导不会推进步骤。
现在来看代码:
设置向导的javascript:
$('#wizard').smartWizard({ transitionEffect: 'slideleft', onLeaveStep: leaveAStepCallback, onFinish: onFinishCallback});与向导的事件关联的简单函数:
// wizard functions
function leaveAStepCallback(obj) {
// Get current step
var step_num = obj.attr('rel'); // get the current step number
}
function onFinishCallback() {
alert('Finish Called');
}
function showStep(obj) {
// Get current step
var step_num = obj.attr('rel'); // get the current step number
}和超文本标记语言标记(为简洁起见,我删除了<p>标记中的步骤内容-这导致它同样缺乏功能,就好像其中有内容一样,所以可以排除这种情况)
<div id="wizDialog">
<div id="wizard" class="swMain">
<ul>
<li><a href="#step-1">
<label class="stepNumber">1</label>
<span class="stepDesc">
Step 1<br />
<small>Step 1 - </small>
</span>
</a></li>
<li><a href="#step-2">
<label class="stepNumber">2</label>
<span class="stepDesc">
Step 2<br />
<small>Step 2 - </small>
</span>
</a></li>
<li><a href="#step-3">
<label class="stepNumber">3</label>
<span class="stepDesc">
Step 3<br />
<small>Step 3 - </small>
</span>
</a></li>
<li><a href="#step-4">
<label class="stepNumber">4</label>
<span class="stepDesc">
Step 4<br />
<small>Step 4 - </small>
</span>
</a></li>
<li><a href="#step-5">
<label class="stepNumber">5</label>
<span class="stepDesc">
Step 5<br />
<small>Step 5 - </small>
</span>
</a></li>
<li><a href="#step-6">
<label class="stepNumber">6</label>
<span class="stepDesc">
Step 6<br />
<small>Step 6 - </small>
</span>
</a></li>
<li><a href="#step-7">
<label class="stepNumber">7</label>
<span class="stepDesc">
Step 7<br />
<small>Step 7 - </small>
</span>
</a></li>
<li><a href="#step-8">
<label class="stepNumber">8</label>
<span class="stepDesc">
Step 8<br />
<small>Step 8 - </small>
</span>
</a></li>
</ul>
<div id="step-1">
<h2 class="StepTitle">Step 1 Content</h2>
<p>
</p>
</div>
<div id="step-2">
<h2 class="StepTitle">Step 2 Content</h2>
<p>
</p>
</div>
<div id="step-3">
<h2 class="StepTitle">Step 3 Content</h2>
<p>
</p>
</div>
<div id="step-4">
<h2 class="StepTitle">Step 4 Content</h2>
<p>
</p>
</div>
<div id="step-5">
<h2 class="StepTitle">Step 5 Content</h2>
<p>
</p>
</div>
<div id="step-6">
<h2 class="StepTitle">Step 6 Content</h2>
<p>
</p>
</div>
<div id="step-7">
<h2 class="StepTitle">Step 7 Content</h2>
<p>
</p>
</div>
<div id="step-8">
<h2 class="StepTitle">Step 8 Content</h2>
<p>
</p>
</div>
</div>
</div>有没有人对此有类似的结果?或者解释一下为什么当向导嵌套在额外的<div>标记中时,向导将无法工作?
发布于 2012-04-10 13:24:51
onLeaveStep要求您返回一个布尔值。返回true,您将能够在向导中前进。
https://stackoverflow.com/questions/9843326
复制相似问题