
A minimal, clean, easy-to-style slider/carousel built using JavaScript, CSS and CSS3 properties.
How to use it:
Add the images, descriptions, and controls to the carousel.
<div class="slider" id="slider">
<figure class="slide">
<img src="1.jpg">
<figcaption>
<div class="title">Slide 1</div>
<div class="author">Diana Bailey</div>
</figcaption>
</figure>
<figure class="slide">
<img src="2.jpg">
<figcaption>
<div class="title">Slide 2</div>
<div class="author">Janie Payne</div>
</figcaption>
</figure>
<figure class="slide">
<img src="3.jpg">
<figcaption>
<div class="title">Slide 3</div>
<div class="author">Kristina Fitzgerald</div>
</figcaption>
</figure>
<figure class="slide">
<img src="4.jpg">
<figcaption>
<div class="title">Slide 4</div>
<div class="author">Beth Garner</div>
</figcaption>
</figure>
<div class="arrows">
<div class="prev">❮</div>
<div class="next">❯</div>
</div>
</div>Load the main JavaScript at the end of the document.
<script src="js/main.min.js"></script>
The primary CSS/CSS3 rules for the carousel.
.slider {
position: relative;
width: 640px;
height: 436px;
margin: 0 auto;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 10px solid white;
text-align: center;
-webkit-border-radius: 5px;
border-radius: 5px;
z-index: 10;
-webkit-box-shadow: 0 10px 15px 3px rgba(0, 0, 0, 0.15), 0 5px 20px 3px rgba(0, 0, 0, 0.1);
box-shadow: 0 10px 15px 3px rgba(0, 0, 0, 0.15), 0 5px 20px 3px rgba(0, 0, 0, 0.1);
}
.slider .slide {
height: 100%;
width: auto;
}
.slider .slide img {
width: 100%;
height: 100%;
}
.slider .slide figcaption {
position: absolute;
top: 30px;
left: 30px;
}
.slider .slide figcaption .title {
font-size: 50px;
color: #2ecc71;
text-transform: uppercase;
letter-spacing: 8px;
}
.slider .slide figcaption .author {
font-size: 18px;
font-weight: 300;
letter-spacing: 3px;
color: #fff;
}
.arrows {
position: absolute;
right: 30px;
bottom: 30px;
width: 100px;
overflow: hidden;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0 3px 3px 3px rgba(0, 0, 0, 0.15);
box-shadow: 0 3px 3px 3px rgba(0, 0, 0, 0.15);
z-index: 10;
}
.arrows .next, .arrows .prev {
float: left;
width: 50%;
height: 40px;
background-color: #fff;
text-align: center;
line-height: 40px;
cursor: pointer;
-webkit-transition: .3s color ease;
-o-transition: .3s color ease;
transition: .3s color ease;
}
.arrows .next:hover, .arrows .prev:hover { color: #2ecc71; }
.pagination {
position: absolute;
bottom: -50px;
left: 50%;
right: auto;
-webkit-transform: translateX(-50%);
-ms-transform: translateX(-50%);
transform: translateX(-50%);
}
.pagination li {
display: inline-block;
float: left;
margin: 0 5px;
}
.pagination li.selected a { background-color: #2ecc71; }
.pagination li a {
display: block;
width: 12px;
height: 12px;
-webkit-border-radius: 50%;
border-radius: 50%;
border: 2px solid #2ecc71;
background-color: #fff;
overflow: hidden;
white-space: nowrap;
}Add your own CSS styles for responsiveness.
/*========== Desktop First ==========*/
/* Large Devices, Wide Screens */
@media only screen and (max-width: 1200px) {
/**/
}
/* Medium Devices, Desktops */
@media only screen and (max-width: 992px) {
/**/
}
/* Small Devices, Tablets */
@media only screen and (max-width: 768px) {
/**/
}
/* Extra Small Devices, Phones */
@media only screen and (max-width: 480px) {
/**/
}
/* Custom, iPhone Retina */
@media only screen and (max-width: 320px) {
/**/
}
/*========== Mobile First ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width: 320px) {
/**/
}
/* Extra Small Devices, Phones */
@media only screen and (min-width: 480px) {
/**/
}
/* Small Devices, Tablets */
@media only screen and (min-width: 768px) {
/**/
}
/* Medium Devices, Desktops */
@media only screen and (min-width: 992px) {
/**/
}
/* Large Devices, Wide Screens */
@media only screen and (min-width: 1200px) {
/**/
}





