加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lyear_pages_guide.html 6.03 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2020-11-18 09:52 . 修改错误的class名
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>表单向导 - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V4是一个后台管理系统的HTML模板,基于Bootstrap v4.4.1。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">表单向导</div></div>
<div class="card-body">
<form action="#!" class="guide-box" data-navigateable="true">
<ul class="nav nav-step">
<li class="nav-item">
<span>步骤一</span>
<a class="nav-link active" data-toggle="tab" href="#step-1"></a>
</li>
<li class="nav-item">
<span>步骤三</span>
<a class="nav-link" data-toggle="tab" href="#step-2"></a>
</li>
<li class="nav-item">
<span>步骤四</span>
<a class="nav-link" data-toggle="tab" href="#step-3"></a>
</li>
<li class="nav-item">
<span>步骤五</span>
<a class="nav-link" data-toggle="tab" href="#step-4"></a>
</li>
</ul>
<!--对应内容-->
<div class="nav-step-content">
<div class="nav-step-pane d-none active" id="step-1" data-provide="validation">
<div class="form-group">
<label>姓名</label>
<input class="form-control" type="text" id="username" required />
</div>
</div>
<div class="nav-step-pane d-none" id="step-2" data-provide="validation">
<div class="form-group">
<label>邮箱地址</label>
<input class="form-control" type="text" id="email" required />
</div>
</div>
<div class="nav-step-pane d-none" id="step-3" data-provide="validation">
<div class="form-group">
<label>设置密码</label>
<input class="form-control" type="password" id="password" required />
</div>
</div>
<div class="nav-step-pane d-none" id="step-4">
<div class="form-group">
<label>备注</label>
<input class="form-control" type="text" id="remark" />
</div>
</div>
</div>
<!--End 对应内容-->
<hr>
<div class="d-flex justify-content-between">
<button class="btn btn-secondary disabled" data-wizard="prev" type="button">上一步</button>
<button class="btn btn-secondary" data-wizard="next" type="button">下一步</button>
<button class="btn btn-primary d-none" data-wizard="finish" type="submit">完成</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="js/jquery.bootstrap.wizard.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var guideObj = $('.guide-box');
var nav_item = guideObj.find('.nav-item');
var tab_pane = guideObj.find('.nav-step-pane');
guideObj.bootstrapWizard({
'tabClass': 'nav-step',
'nextSelector': '[data-wizard="next"]',
'previousSelector': '[data-wizard="prev"]',
'finishSelector': '[data-wizard="finish"]',
'onTabClick': function(e, t, i) {
// data-navigateable='true'允许用户直接点击步骤项,false则只能通过按钮
if ( !$('.guide-box').is('[data-navigateable="true"]') ) {
return false;
}
},
'onTabShow': function(e, t, i) {
t.children(":gt(" + i + ").complete").removeClass("complete");
t.children(":lt(" + i + "):not(.complete)").addClass("complete");
},
'onNext': function(tab, navigation, index){
var current_index = guideObj.bootstrapWizard('currentIndex');
var curr_tab = tab_pane.eq(current_index);
var validator_selector = '[data-provide="validation"]';
var validator = curr_tab.find(validator_selector).addBack(validator_selector);
if (validator.length) {
var forms = validator.find('input, select, textarea');
var validation = true;
forms.each(function() {
if (this.checkValidity() === false) {
guideObj.addClass('was-validated');
validation = false;
} else {
guideObj.removeClass('was-validated');
}
});
if (!validation) {
guideObj.addClass('was-validated');
return false;
}
}
},
'onPrevious': function(){
},
'onFinish': function(e, t, i) {
var nav = nav_item.eq(i);
nav.addClass('complete').find('a.nav-link').removeClass('active');
return false; // 这里为了演示效果,阻止其继续
}
});
});
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化