<div class="slider">
<div class="slide" data-bg="http://www.testq.com/nfs/testq/attachment_images/0000/5208/architect.jpg"><span>Design</span></div>
<div class="slide" data-bg="http://www.guardnow.com/wp-content/uploads/2011/07/construction.jpg"><span>Build</span></div>
<div class="slide" data-bg="http://browndavisinteriors.designshuffle.com/miami-vice-house-2656-2963/t2/miami-vice-house-living-room-24146-1900.jpg"><span>Enjoy</span></div>
</div>
<button class="next">Next</button>
body {
background: #ddd;
}
.slider {
width: 640px;
height: 360px;
margin: 50px auto 50px auto;
background: #fff;
position: relative;
overflow: hidden;
border-radius: 15px;
box-shadow: 0 0 15px rgba(#000, .75);
.slide {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 100%;
background-size: cover;
background-position: center center;
&:nth-child(1) {
top: 0;
}
span {
color: #fff;
font-family: sans-serif;
font-size: 50px;
position: absolute;
bottom: 25px;
right: 25px;
text-shadow: 0 0 5px #000;
}
}
}
button {
display: block;
margin: 0 auto;
width: 180px;
height: 60px;
text-align: center;
color: #fff;
background: #99cc00;
border: 0;
font-size: 24px;
text-transform: uppercase;
cursor: pointer;
transition: all .3s ease;
&:hover {
background: darken(#99cc00, 10%);
}
}
View Compiled
$(document).ready(function() {
$(".slide").each(function() {
$(this).css("background-image", "url("+$(this).data("bg")+")");
});
var current = 0;
var count = 2;
$(document).on("click", ".next", function(e) {
$(".slide:eq("+current+")").css("z-index", "0").animate({
top: "-100%"
}, 1000, function() {
$(this).css("top", "100%");
});
current++;
if (current > count) {
current = 0;
}
$(".slide:eq("+current+")").css("z-index", "1").animate({
top: "0%"
}, 500);
e.preventDefault();
});
});
This Pen doesn't use any external CSS resources.