我正在使用IE 8和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
}
HTML标记(为了简洁起见,我删除了<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>
标签中时向导无法工作?
答案 0 :(得分:1)
onLeaveStep要求您返回一个布尔值。返回true,你将能够通过向导。