Hal*_*nce 1 javascript jquery jsp jquery-plugins jquery-steps
我正在为我的向导类型表单使用 jQuery-steps 插件。我想显示加载...动画,直到整个向导完全加载。插件中为此提供了标签。我只是不知道如何启用它。
有什么猜想吗?
编辑 :
这是我生成向导表单的代码
$(function () {
$("#wizard").steps({
headerTag: "h2",
bodyTag: "form",
saveState: true,
transitionEffect: "slideLeft",
onStepChanging: function stepChange(event, currentIndex, newIndex) {
if (currentIndex > newIndex) {
for(i=currentIndex;i>0;i--){
$("#sec"+i+"override").val(true);
}
return true;
}
e=event;
ci=currentIndex;
ni=newIndex;
var form = $('#wizard-p-'+currentIndex);
form.validate().settings.ignore = ":disabled,:hidden:not('.hiddenField')";
var res = form.valid();
if(res) {
var ress = form.submit();
if(check) {
return true ;
} else {
popup();
}
}
},
onFinishing: function(event, currentIndex) {
ci=currentIndex;
var form = $('#wizard-p-'+currentIndex);
form.validate().settings.ignore = ":disabled,:hidden:not('.hiddenField')";
var res = form.valid();
if(res) {
var ress = form.submit();
if(check) {
return true;
} else {
popup();
}
}
},
onFinished: function(event, currentIndex) {
<%
UserDTO user = UserUtils.getLoggedInUser();
if(user!=null){
if(user.getIsAdmin()){
%>
window.location = "<%=application.getContextPath()%>/projects";
<%
} else {
%>
window.location = "<%=application.getContextPath()%>/home";
<%
}
}
%>
$.cookie('jQu3ry_5teps_St@te_' + $( this ).data( "uid" ), '' );
}
});
});
Run Code Online (Sandbox Code Playgroud)
现在的事情是它完美地工作,但是在加载整个表单时,它首先显示部分标题,然后加载表单,这看起来不太好。我只想显示加载...动画直到整个表单加载。
如果我正确理解了这个问题......在页面加载后,表单正在加载一点,导致用户在逐步初始化之前查看表单。如果是这种情况,您可以添加一个包含加载动画的附加 div,并且在页面加载时不显示您的表单...
<div id="loadingIcon">
<img src="images/loading.gif"/>
</div>
<div id="wizard" style="display: none;">
<%-- FORM HERE --%>
</div>
Run Code Online (Sandbox Code Playgroud)
然后在您的 onload 函数中,隐藏加载图标并显示表单。
$(function () {
$("#wizard").steps({
// Steps
});
$('#loadingIcon').hide();
$('#wizard').show();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2658 次 |
| 最近记录: |