<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.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="slider-container">
<div class="slider-content">
<div class="slider-single">
<img class="slider-single-image" src="http://eduardoallegrini.com/projects/codepen/3d-smooth-carousel/main.jpg" alt="1" />
<a class="slider-single-download" href="javascript:void(0);">Download <i class="fa fa-download"></i></a>
<h1 class="slider-single-title">Through the Mountains</h1>
<a class="slider-single-likes" href="javascript:void(0);">
<i class="fa fa-heart"></i>
<p>1,247</p>
</a>
</div>
<div class="slider-single">
<img class="slider-single-image" src="http://eduardoallegrini.com/projects/codepen/3d-smooth-carousel/main.jpg" alt="2" />
<a class="slider-single-download" href="javascript:void(0);">Download <i class="fa fa-download"></i></a>
<h1 class="slider-single-title">Through the Mountains</h1>
<a class="slider-single-likes" href="javascript:void(0);">
<i class="fa fa-heart"></i>
<p>1,247</p>
</a>
</div>
<div class="slider-single">
<img class="slider-single-image" src="http://eduardoallegrini.com/projects/codepen/3d-smooth-carousel/main.jpg" alt="3" />
<a class="slider-single-download" href="javascript:void(0);">Download <i class="fa fa-download"></i></a>
<h1 class="slider-single-title">Through the Mountains</h1>
<a class="slider-single-likes" href="javascript:void(0);">
<i class="fa fa-heart"></i>
<p>1,247</p>
</a>
</div>
<div class="slider-single">
<img class="slider-single-image" src="http://eduardoallegrini.com/projects/codepen/3d-smooth-carousel/main.jpg" alt="4" />
<a class="slider-single-download" href="javascript:void(0);">Download <i class="fa fa-download"></i></a>
<h1 class="slider-single-title">Through the Mountains</h1>
<a class="slider-single-likes" href="javascript:void(0);">
<i class="fa fa-heart"></i>
<p>1,247</p>
</a>
</div>
<div class="slider-single">
<img class="slider-single-image" src="http://eduardoallegrini.com/projects/codepen/3d-smooth-carousel/main.jpg" alt="5" />
<a class="slider-single-download" href="javascript:void(0);">Download <i class="fa fa-download"></i></a>
<h1 class="slider-single-title">Through the Mountains</h1>
<a class="slider-single-likes" href="javascript:void(0);">
<i class="fa fa-heart"></i>
<p>1,247</p>
</a>
</div>
<div class="slider-single">
<img class="slider-single-image" src="http://eduardoallegrini.com/projects/codepen/3d-smooth-carousel/main.jpg" alt="6" />
<a class="slider-single-download" href="javascript:void(0);">Download <i class="fa fa-download"></i></a>
<h1 class="slider-single-title">Through the Mountains</h1>
<a class="slider-single-likes" href="javascript:void(0);">
<i class="fa fa-heart"></i>
<p>1,247</p>
</a>
</div>
</div>
<a class="slider-left" href="javascript:void(0);"><i class="fa fa-arrow-left"></i></a>
<a class="slider-right" href="javascript:void(0);"><i class="fa fa-arrow-right"></i></a>
</div>
@keyframes heartbeat {
0% {
transform: scale(0);
}
25% {
transform: scale(1.2);
}
50% {
transform: scale(1);
}
75% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
body {
color: #FFFFFF;
background-color: #27292d;
overflow: hidden;
}
.slider-container {
position: absolute;
left: 50%;
top: 50%;
width: 800px;
height: 600px;
margin: -300px 0 0 -400px;
}
.slider-container .slider-content {
position: relative;
left: 50%;
top: 50%;
width: 70%;
height: 60%;
transform: translate(-50%, -50%);
}
.slider-container .slider-content .slider-single {
position: absolute;
z-index: 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
transition: z-index 0ms 250ms;
}
.slider-container .slider-content .slider-single .slider-single-image {
position: relative;
left: 0;
top: 0;
width: 100%;
height: 100%;
box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.2);
transition: 500ms cubic-bezier(0.17, 0.67, 0.55, 1.43);
transform: scale(0);
opacity: 0;
}
.slider-container .slider-content .slider-single .slider-single-download {
position: absolute;
display: block;
right: -22px;
bottom: 12px;
padding: 15px;
color: #333333;
background-color: #fdc84b;
font-size: 18px;
font-weight: 600;
font-family: 'karla';
border-radius: 5px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
transition: 500ms cubic-bezier(0.17, 0.67, 0.55, 1.43);
opacity: 0;
}
.slider-container .slider-content .slider-single .slider-single-download:hover, .slider-container .slider-content .slider-single .slider-single-download:focus {
outline: none;
text-decoration: none;
}
.slider-container .slider-content .slider-single .slider-single-title {
display: block;
float: left;
margin: 16px 0 0 20px;
font-size: 20px;
font-family: 'karla';
font-weight: 400;
color: #ffffff;
transition: 500ms cubic-bezier(0.17, 0.67, 0.55, 1.43);
opacity: 0;
}
.slider-container .slider-content .slider-single .slider-single-likes {
display: block;
float: right;
margin: 16px 20px 0 0;
transition: 500ms cubic-bezier(0.17, 0.67, 0.55, 1.43);
opacity: 0;
}
.slider-container .slider-content .slider-single .slider-single-likes i {
font-size: 20px;
display: inline-block;
vertical-align: middle;
margin-right: 5px;
color: #ff6060;
transition: 500ms cubic-bezier(0.17, 0.67, 0.55, 1.43);
transform: scale(0);
}
.slider-container .slider-content .slider-single .slider-single-likes p {
display: inline-block;
vertical-align: middle;
margin: 0;
color: #ffffff;
}
.slider-container .slider-content .slider-single .slider-single-likes:hover, .slider-container .slider-content .slider-single .slider-single-likes:focus {
outline: none;
text-decoration: none;
}
.slider-container .slider-content .slider-single.preactivede .slider-single-image {
transform: translateX(-50%) scale(0);
}
.slider-container .slider-content .slider-single.preactive {
z-index: 1;
}
.slider-container .slider-content .slider-single.preactive .slider-single-image {
opacity: .3;
transform: translateX(-25%) scale(0.8);
}
.slider-container .slider-content .slider-single.preactive .slider-single-download {
transform: translateX(-150px);
}
.slider-container .slider-content .slider-single.preactive .slider-single-title {
transform: translateX(-150px);
}
.slider-container .slider-content .slider-single.preactive .slider-single-likes {
transform: translateX(-150px);
}
.slider-container .slider-content .slider-single.proactive {
z-index: 1;
}
.slider-container .slider-content .slider-single.proactive .slider-single-image {
opacity: .3;
transform: translateX(25%) scale(0.8);
}
.slider-container .slider-content .slider-single.proactive .slider-single-download {
transform: translateX(150px);
}
.slider-container .slider-content .slider-single.proactive .slider-single-title {
transform: translateX(150px);
}
.slider-container .slider-content .slider-single.proactive .slider-single-likes {
transform: translateX(150px);
}
.slider-container .slider-content .slider-single.proactivede .slider-single-image {
transform: translateX(50%) scale(0);
}
.slider-container .slider-content .slider-single.active {
z-index: 2;
}
.slider-container .slider-content .slider-single.active .slider-single-image {
opacity: 1;
transform: translateX(0%) scale(1);
}
.slider-container .slider-content .slider-single.active .slider-single-download {
opacity: 1;
transition-delay: 100ms;
transform: translateX(0px);
}
.slider-container .slider-content .slider-single.active .slider-single-title {
opacity: 1;
transition-delay: 200ms;
transform: translateX(0px);
}
.slider-container .slider-content .slider-single.active .slider-single-likes {
opacity: 1;
transition-delay: 300ms;
transform: translateX(0px);
}
.slider-container .slider-content .slider-single.active .slider-single-likes i {
animation-name: heartbeat;
animation-duration: 500ms;
animation-delay: 900ms;
animation-interation: 1;
animation-fill-mode: forwards;
}
.slider-container .slider-left {
position: absolute;
z-index: 3;
display: block;
right: 85%;
top: 50%;
color: #ffffff;
transform: translateY(-50%);
padding: 20px 15px;
border-top: 2px solid #fdc84b;
border-right: 2px solid #fdc84b;
border-bottom: 2px solid #fdc84b;
border-left: 2px solid #fdc84b;
margin-right: -2px;
}
.slider-container .slider-right {
position: absolute;
z-index: 3;
display: block;
left: 85%;
top: 50%;
color: #ffffff;
transform: translateY(-50%);
padding: 20px 15px;
border-top: 2px solid #fdc84b;
border-right: 2px solid #fdc84b;
border-bottom: 2px solid #fdc84b;
border-left: 2px solid #fdc84b;
margin-left: -2px;
}
$(document).on('ready', function() {
var slide = $('.slider-single');
var slideTotal = slide.length - 1;
var slideCurrent = -1;
function slideInitial() {
slide.addClass('proactivede');
setTimeout(function() {
slideRight();
}, 500);
}
function slideRight() {
if (slideCurrent < slideTotal) {
slideCurrent++;
} else {
slideCurrent = 0;
}
if (slideCurrent > 0) {
var preactiveSlide = slide.eq(slideCurrent - 1);
} else {
var preactiveSlide = slide.eq(slideTotal);
}
var activeSlide = slide.eq(slideCurrent);
if (slideCurrent < slideTotal) {
var proactiveSlide = slide.eq(slideCurrent + 1);
} else {
var proactiveSlide = slide.eq(0);
}
slide.each(function() {
var thisSlide = $(this);
if (thisSlide.hasClass('preactivede')) {
thisSlide.removeClass('preactivede preactive active proactive').addClass('proactivede');
}
if (thisSlide.hasClass('preactive')) {
thisSlide.removeClass('preactive active proactive proactivede').addClass('preactivede');
}
});
preactiveSlide.removeClass('preactivede active proactive proactivede').addClass('preactive');
activeSlide.removeClass('preactivede preactive proactive proactivede').addClass('active');
proactiveSlide.removeClass('preactivede preactive active proactivede').addClass('proactive');
}
function slideLeft() {
if (slideCurrent > 0) {
slideCurrent--;
} else {
slideCurrent = slideTotal;
}
if (slideCurrent < slideTotal) {
var proactiveSlide = slide.eq(slideCurrent + 1);
} else {
var proactiveSlide = slide.eq(0);
}
var activeSlide = slide.eq(slideCurrent);
if (slideCurrent > 0) {
var preactiveSlide = slide.eq(slideCurrent - 1);
} else {
var preactiveSlide = slide.eq(slideTotal);
}
slide.each(function() {
var thisSlide = $(this);
if (thisSlide.hasClass('proactivede')) {
thisSlide.removeClass('preactive active proactive proactivede').addClass('preactivede');
}
if (thisSlide.hasClass('proactive')) {
thisSlide.removeClass('preactivede preactive active proactive').addClass('proactivede');
}
});
preactiveSlide.removeClass('preactivede active proactive proactivede').addClass('preactive');
activeSlide.removeClass('preactivede preactive proactive proactivede').addClass('active');
proactiveSlide.removeClass('preactivede preactive active proactivede').addClass('proactive');
}
var left = $('.slider-left');
var right = $('.slider-right');
left.on('click', function() {
slideLeft();
});
right.on('click', function() {
slideRight();
});
slideInitial();
});