"tab-carousel"
Bootstrap 3.3.0 Snippet by indra1191

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="http://images.yuppcdn.net/bazaar/20161124204954623186/1480000794638.jpg">
</div>
<!-- End Item -->
<div class="item">
<img src="http://images.yuppcdn.net/bazaar/20161219130950950809/1482133190966.jpg">
</div>
<!-- End Item -->
<div class="item">
<img src="http://images.yuppcdn.net/bazaar/20161219120644711101/1482129404711.jpg">
</div>
<!-- End Item -->
<div class="item">
<img src="http://images.yuppcdn.net/images/20161021150745619424/1477042665635.jpg">
</div>
<!-- End Item -->
</div>
<!-- End Carousel Inner -->
<ul class="nav nav-pills nav-justified">
<li data-target="#myCarousel" data-slide-to="0" class="active"><a href="#">About<small>Lorem
ipsum dolor sit</small></a></li>
<li data-target="#myCarousel" data-slide-to="1"><a href="#">Projects<small>Lorem ipsum
dolor sit</small></a></li>
<li data-target="#myCarousel" data-slide-to="2"><a href="#">Portfolio<small>Lorem ipsum
dolor sit</small></a></li>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
body
{
padding-top: 20px;
}
#myCarousel .nav a small
{
display: block;
}
#myCarousel .nav
{
background: rgb(0,0,0);
background: rgba(0,0,0, 0.7);
overflow-y: hidden;
transition: 0.5s;
}
#myCarousel .nav :hover
{
background: rgb(0,0,0);
background: rgba(0,0,0, 0.7);
overflow-y: hidden;
transition: 0.5s;
}
.nav-justified > li > a
{
border-radius: 0px;
}
.nav-pills>li[data-slide-to="0"].active a { background-color: rgba(76,76,76, 0.7); color:#fff;}
.nav-pills>li[data-slide-to="1"].active a { background-color: rgba(76,76,76, 0.7); color:#fff;}
.nav-pills>li[data-slide-to="2"].active a { background-color: rgba(76,76,76, 0.7); color:#fff;}
.nav-pills>li[data-slide-to="3"].active a { background-color: rgba(76,76,76, 0.7); color:#fff;}
.nav {
padding-left: 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$(document).ready( function() {
$('#myCarousel').carousel({
interval: 4000
});
var clickEvent = false;
$('#myCarousel').on('click', '.nav a', function() {
clickEvent = true;
$('.nav li').removeClass('active');
$(this).parent().addClass('active');
}).on('slid.bs.carousel', function(e) {
if(!clickEvent) {
var count = $('.nav').children().length -1;
var current = $('.nav li.active');
current.removeClass('active').next().addClass('active');
var id = parseInt(current.data('slide-to'));
if(count == id) {
$('.nav li').first().addClass('active');
}
}
clickEvent = false;
});
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

Thanks, but all of these kind of tab carousels have one same problem.
When the loop finish all tabs sliding, the tabs is not working when second or thirth loop is starting, how can i fix it?

Vyprazany Karfiol () - 8 years ago - Reply 0