Bootstrap 4 - alpha 6 Nav Tabs
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<section>
<div class="wizard">
<div class="wizard-inner">
<div class="active-line"></div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active stepactive1">
<div class="connecting-line border-right"></div>
<a href="#step1" data-toggle="tab" aria-controls="step1" role="tab" title="Step 1">
<span class="round-tab">
1
</span>
<p>Create Account</p>
</a>
</li>
<li role="presentation" class="disabled stepactive2">
<div class="connecting-line border-right border-left"></div>
<a href="#step2" data-toggle="tab" aria-controls="step2" role="tab" title="Step 2">
<span class="round-tab">
2
</span>
...
SCSS
.wizard {
background: #f1f1f1;
padding: 30px;
}
.wizard .nav-tabs {
position: relative;
border: 0px;
}
.wizard > div.wizard-inner {
position: relative;
}
.connecting-line{
height:15px;
background: #e0e0e0;
position: absolute;
width: 99.5%;
margin: 0 auto;
left: 0;
right: 0;
top:44%;
z-index: 1;
border-radius: 15px;
}
.active-line{
height:15px;
background: #e0e0e0;
position: absolute;
width: 99.5%;
margin: 0 auto;
left: 0;
right: 0;
top:44%;
z-index: 1;
border-radius: 15px !important;
}
.active .connecting-line{
background-color: #2ED4E0;
}
.border-right{
border-radius: 15px 0 0 15px;
}
.border-left{
border-radius: 0;
}
.wizard .nav-tabs > li.active > a, .wizard .nav-tabs > li.active > a:hover, .wizard .nav-tabs > li.active > a:focus {
cursor: default;
border: 0;
color:#2ED4E0;
border-bottom-color: transparent;
}
.nav-tabs li p{
padding-top:70px;
font-size: 16px;
text-align: center;
}
.list-inline{
text-align: center;
}
span.round-tab {
width: 70px;
height: 70px;
line-height: 70px;
display: inline-block;
border-radius: 100px;
background:#DFE3E4;
border: 2px solid #fff;
z-index:1;
position:absolute;
text-align: center;
font-size: 25px;
}
.wizard li.active span.round-tab{
background:#2ED4E0;
color:white;
border: 2px solid #fff;
}
span.round-tab:hover{
color: white;
border: 2px solid #fff;
background-color:#2ED4E0;
}
.wizard .nav-tabs > li {
width: 25%;
}
.wizard .nav-tabs > li a{
width: 70px;
height: 70px;
margin: 20px auto;
border-radius: 100%;
padding: 0;
color: #777;
}
.wizard .tab-pane {
position: relative;
padding-top: 15px;
border-top: 1px solid #fff;
margin-top: 50px;
}
.next-step:hover, .next-step, .prev-step:hover, .prev-step{
position: relative;
background-color: #2ED4E0;
font-size: 16px;
...
JavaScript
$(document).ready(function () {
$('.nav-tabs > li a[title]').tooltip();
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
alert("asdasdasd");
var $target = $(e.target);
if ($target.parent().hasClass('disabled')) {
return false;
}
});
$(".next-step").click(function (e) {
var $active = $('.wizard .nav-tabs li.active');
$active.next().removeClass('disabled');
nextTab($active);
$('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0});
});
$(".prev-step").click(function (e) {
var $active = $('.wizard .nav-tabs li.active');
prevTab($active);
});
});
function nextTab(elem) {
$(elem).next().find('a[data-toggle="tab"]').click();
}
function prevTab(elem) {
$(elem).prev().find('a[data-toggle="tab"]').click();
}