我正在为我的向导类型表单使用jQuery-step插件。我想展示一下加载...动画,直到整个向导完全加载。在插件中为此提供了标签。我只是不知道如何启用它。
你猜对了吗?
编辑:
下面是生成向导表单的代码
$(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" ), '' );
}
});
});现在的问题是,它工作得很好,但当加载整个表单时,它首先显示部分标题,然后加载表单,这看起来并不好。我只想展示一下加载...动画,直到整个窗体加载。
发布于 2016-03-14 20:58:30
如果我没弄错问题的话...表单加载稍晚于页面加载,导致用户在按步骤初始化表单之前查看表单。如果是这种情况,您可以添加一个包含加载动画的额外div,并且在页面加载时不显示表单...
<div id="loadingIcon">
<img src="images/loading.gif"/>
</div>
<div id="wizard" style="display: none;">
<%-- FORM HERE --%>
</div>然后在onload函数中,隐藏加载图标并显示表单。
$(function () {
$("#wizard").steps({
// Steps
});
$('#loadingIcon').hide();
$('#wizard').show();
});https://stackoverflow.com/questions/34530001
复制相似问题