Original
2014
Checked radio inputs + general sibling (~) selectors
The Carousel works fine!
NOTE: to add new items it is necessary to make changes in the CSS, this might require some additional work.
View the 2014 code
<!-- Carousel -->
<div class="carousel">
<div class="carousel-inner">
<input class="carousel-open" type="radio" id="then-carousel-1" name="then-carousel" aria-hidden="true" hidden checked>
<div class="carousel-item">
<img src="/exhibits/carousel/slide-1.svg" alt="Slide 1: Very nice :D">
</div>
<input class="carousel-open" type="radio" id="then-carousel-2" name="then-carousel" aria-hidden="true" hidden>
<div class="carousel-item">
<img src="/exhibits/carousel/slide-2.svg" alt="Slide 2: Good move!">
</div>
<input class="carousel-open" type="radio" id="then-carousel-3" name="then-carousel" aria-hidden="true" hidden>
<div class="carousel-item">
<img src="/exhibits/carousel/slide-3.svg" alt="Slide 3: CSS is Life">
</div>
<label for="then-carousel-3" class="carousel-control prev control-1">‹</label>
<label for="then-carousel-2" class="carousel-control next control-1">›</label>
<label for="then-carousel-1" class="carousel-control prev control-2">‹</label>
<label for="then-carousel-3" class="carousel-control next control-2">›</label>
<label for="then-carousel-2" class="carousel-control prev control-3">‹</label>
<label for="then-carousel-1" class="carousel-control next control-3">›</label>
<ol class="carousel-indicators">
<li><label for="then-carousel-1" class="carousel-bullet">•</label></li>
<li><label for="then-carousel-2" class="carousel-bullet">•</label></li>
<li><label for="then-carousel-3" class="carousel-bullet">•</label></li>
</ol>
</div>
</div>
<!-- /Carousel -->/* Carousel - Pure CSS (no JavaScript) */
.carousel {
position: relative;
}
.carousel-inner {
position: relative;
overflow: hidden;
width: 100%;
}
.carousel-open:checked + .carousel-item {
position: static;
opacity: 100;
}
.carousel-item {
position: absolute;
opacity: 0;
transition: opacity 0.6s ease-out;
}
.carousel-item img {
display: block;
height: auto;
max-width: 100%;
}
/* Carousel Control */
.carousel-control {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0, 0, 0, 0.5);
border: #aaa solid 1px;
border-radius: 50%;
color: #fff;
cursor: pointer;
display: none;
font-size: 40px;
height: 40px;
line-height: 35px;
text-align: center;
width: 40px;
z-index: 10;
}
.carousel-control.prev {
left: 2%;
}
.carousel-control.next {
right: 2%;
}
.carousel-control:hover {
background: rgba(0, 0, 0, 0.8);
color: #aaa;
}
#then-carousel-1:checked ~ .control-1,
#then-carousel-2:checked ~ .control-2,
#then-carousel-3:checked ~ .control-3 {
display: block;
}
/* Carousel Indicators */
.carousel-indicators {
margin-bottom: 0;
padding-left: 0;
list-style: none;
position: absolute;
bottom: 2%;
left: 0;
right: 0;
text-align: center;
z-index: 10;
}
.carousel-indicators li {
display: inline-block;
margin: 0 5px;
}
.carousel-bullet {
color: #fff;
cursor: pointer;
display: block;
font-size: 35px;
}
.carousel-bullet:hover {
color: #aaa;
}
#then-carousel-1:checked ~ .control-1 ~ .carousel-indicators li:nth-child(1) .carousel-bullet,
#then-carousel-2:checked ~ .control-2 ~ .carousel-indicators li:nth-child(2) .carousel-bullet,
#then-carousel-3:checked ~ .control-3 ~ .carousel-indicators li:nth-child(3) .carousel-bullet {
color: #428bca;
}