"Slider"
Bootstrap 4.1.1 Snippet by Umerfarooq

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/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,700">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:400,700">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<div class="slider__warpper">
<div class="flex__container flex--pikachu flex--active" data-slide="1">
<div class="flex__item flex__item--left">
<div class="flex__content">
<p class="text--sub">Pokemon Gen I</p>
<h1 class="text--big">Pikachu</h1>
<p class="text--normal">Pikachu is an Electric-type Pokémon introduced in Generation I. Pikachu are small, chubby, and incredibly cute mouse-like Pokémon. They are almost completely covered by yellow fur.</p>
</div>
<p class="text__background">Pikachu</p>
</div>
<div class="flex__item flex__item--right"></div>
<img class="pokemon__img" src="https://s4.postimg.org/fucnrdeq5/pikachu.png" />
</div>
<div class="flex__container flex--piplup animate--start" data-slide="2">
<div class="flex__item flex__item--left">
<div class="flex__content">
<p class="text--sub">Pokemon Gen IV</p>
<h1 class="text--big">Piplup</h1>
<p class="text--normal">Piplup is the Water-type Starter Pokémon of the Sinnoh region. It was introduced in Generation IV. Piplup has a strong sense of self-esteem. It seldom accepts food that people give because of its pride.</p>
</div>
<p class="text__background">Piplup</p>
</div>
<div class="flex__item flex__item--right"></div>
<img class="pokemon__img" src="https://s4.postimg.org/sa9dl4825/pilup.png" />
</div>
<div class="flex__container flex--blaziken animate--start" data-slide="3">
<div class="flex__item flex__item--left">
<div class="flex__content">
<p class="text--sub">Pokemon Gen III</p>
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
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.slider__navi {
position: absolute;
top: 50%;
right: 20px;
transform: translateY(-50%);
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
z-index: 999;
}
.slider__navi a {
display: block;
height: 6px;
width: 20px;
margin: 20px 0;
text-indent: -9999px;
box-shadow: none;
border: none;
background: rgba(0,0,0,0.2);
}
.slider__navi a.active {
background: rgba(255,255,255,1);
}
body {
position: relative;
font-size: 100%;
font-family: 'Montserrat', sans-serif;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$('.slide-nav').on('click', function(e) {
e.preventDefault();
// get current slide
var current = $('.flex--active').data('slide'),
// get button data-slide
next = $(this).data('slide');
$('.slide-nav').removeClass('active');
$(this).addClass('active');
if (current === next) {
return false;
} else {
$('.slider__warpper').find('.flex__container[data-slide=' + next + ']').addClass('flex--preStart');
$('.flex--active').addClass('animate--end');
setTimeout(function() {
$('.flex--preStart').removeClass('animate--start flex--preStart').addClass('flex--active');
$('.animate--end').addClass('animate--start').removeClass('animate--end flex--active');
}, 800);
}
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: