Add index slideshow
This commit is contained in:
parent
1dea16eea3
commit
97f5fe973e
6 changed files with 136 additions and 0 deletions
BIN
images/1.jpg
Normal file
BIN
images/1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 220 KiB |
BIN
images/2.jpg
Normal file
BIN
images/2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
images/3.jpg
Normal file
BIN
images/3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 KiB |
BIN
images/4.jpg
Normal file
BIN
images/4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
BIN
images/5.jpg
Normal file
BIN
images/5.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
136
index.html
Normal file
136
index.html
Normal file
|
@ -0,0 +1,136 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>nikhil.horse</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
* {box-sizing: border-box;}
|
||||
body {font-family: Verdana, sans-serif;}
|
||||
.mySlides {display: none;}
|
||||
img {vertical-align: middle;}
|
||||
|
||||
/* Slideshow container */
|
||||
.slideshow-container {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Caption text */
|
||||
.text {
|
||||
color: #f2f2f2;
|
||||
font-size: 15px;
|
||||
padding: 8px 12px;
|
||||
position: absolute;
|
||||
bottom: 8px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Number text (1/3 etc) */
|
||||
.numbertext {
|
||||
color: #f2f2f2;
|
||||
font-size: 12px;
|
||||
padding: 8px 12px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* The dots/bullets/indicators */
|
||||
.dot {
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
margin: 0 2px;
|
||||
background-color: #bbb;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
transition: background-color 0.6s ease;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #717171;
|
||||
}
|
||||
|
||||
/* Fading animation */
|
||||
.fade {
|
||||
-webkit-animation-name: fade;
|
||||
-webkit-animation-duration: 1.5s;
|
||||
animation-name: fade;
|
||||
animation-duration: 1.5s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fade {
|
||||
from {opacity: .4}
|
||||
to {opacity: 1}
|
||||
}
|
||||
|
||||
@keyframes fade {
|
||||
from {opacity: .4}
|
||||
to {opacity: 1}
|
||||
}
|
||||
|
||||
/* On smaller screens, decrease text size */
|
||||
@media only screen and (max-width: 300px) {
|
||||
.text {font-size: 11px}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="slideshow-container">
|
||||
|
||||
<div class="mySlides fade">
|
||||
<div class="numbertext">1 / 5</div>
|
||||
<img src="images/1.jpg" style="width:auto">
|
||||
</div>
|
||||
<div class="mySlides fade">
|
||||
<div class="numbertext">2 / 5</div>
|
||||
<img src="images/2.jpg" style="width:auto">
|
||||
</div>
|
||||
<div class="mySlides fade">
|
||||
<div class="numbertext">3 / 5</div>
|
||||
<img src="images/3.jpg" style="width:auto">
|
||||
</div>
|
||||
<div class="mySlides fade">
|
||||
<div class="numbertext">4 / 5</div>
|
||||
<img src="images/4.jpg" style="width:auto">
|
||||
</div>
|
||||
<div class="mySlides fade">
|
||||
<div class="numbertext">5 / 5</div>
|
||||
<img src="images/5.jpg" style="width:auto">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div style="text-align:center">
|
||||
<span class="dot"></span>
|
||||
<span class="dot"></span>
|
||||
<span class="dot"></span>
|
||||
<span class="dot"></span>
|
||||
<span class="dot"></span>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var slideIndex = 0;
|
||||
showSlides();
|
||||
|
||||
function showSlides() {
|
||||
var i;
|
||||
var slides = document.getElementsByClassName("mySlides");
|
||||
var dots = document.getElementsByClassName("dot");
|
||||
for (i = 0; i < slides.length; i++) {
|
||||
slides[i].style.display = "none";
|
||||
}
|
||||
slideIndex++;
|
||||
if (slideIndex > slides.length) {slideIndex = 1}
|
||||
for (i = 0; i < dots.length; i++) {
|
||||
dots[i].className = dots[i].className.replace(" active", "");
|
||||
}
|
||||
slides[slideIndex-1].style.display = "block";
|
||||
dots[slideIndex-1].className += " active";
|
||||
setTimeout(showSlides, 5000); // Change image every 2 seconds
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue