Twitter bootstrap 单击“下一步”时停止引导窗体向导
我正在使用引导表单向导,当用户单击“继续”按钮时,他们会移动到下一个选项卡,但页面会向下滚动 我已经查看了jquery.bootstrap.wizard文件,该文件包含脚本,但找不到与焦点或动画有关的任何内容 如果我删除此代码,滚动将不会发生,但“后退”和“最终提交”按钮将消失Twitter bootstrap 单击“下一步”时停止引导窗体向导,twitter-bootstrap,twitter-bootstrap-3,twitter-bootstrap-wizard,Twitter Bootstrap,Twitter Bootstrap 3,Twitter Bootstrap Wizard,我正在使用引导表单向导,当用户单击“继续”按钮时,他们会移动到下一个选项卡,但页面会向下滚动 我已经查看了jquery.bootstrap.wizard文件,该文件包含脚本,但找不到与焦点或动画有关的任何内容 如果我删除此代码,滚动将不会发生,但“后退”和“最终提交”按钮将消失 if($settings.onNext&&typeof$settings.onNext=='function'&&$settings.onNext($activeTab,$navigation,obj.nextIndex
if($settings.onNext&&typeof$settings.onNext=='function'&&$settings.onNext($activeTab,$navigation,obj.nextIndex())==false){
返回false;
}
您应该将scrolltop脚本添加到onTabShow事件中:
1。Scrolltop脚本
$('html, body').animate({
scrollTop: $("#rootwizard").offset().top
}, 1000);
2。OntabShow表单向导事件:
$('#rootwizard').bootstrapWizard({
'tabClass': 'nav nav-pills',
onTabShow:function(tab,navigation,index){
//Animate scrolltop
$('html, body').animate({
scrollTop: $("#rootwizard").offset().top
}, 1000);
}
});
你在用什么
用这个
function dontGoToNextStep() {
$validator.focusInvalid();
return false;
};
看看如何使用它
'onNext': function (tab, navigation, index) {
//#region Dont Move Next If there is a Validation Errors
var $valid = _form.valid();
if (!$valid) {
return dontGoToNextStep();
}
//#endregion Dont Move Next If there is a Validation Errors
....
if (someCondition)
return dontGoToNextStep();
...
}