/* Implementing slideshow functionality */
var currentIndex = 0;
displaySlides();
function displaySlides() {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
currentIndex++;
if (currentIndex > slides.length) {currentIndex = 1}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[currentIndex-1].style.display = "flex";
dots[currentIndex-1].className += " active";
setTimeout(displaySlides, 5000); // Change image every 2 seconds
}
/* End of slideshow implementation */
@charset "UTF-8";
/* Stylesheet */
body {
margin: 0;
font-size: 28px;
background-color: #00011f;
display: flex;
flex-direction: column;
margin : auto;
}
img {vertical-align: middle;}
/* Slideshow container */
#slideshow{
float: flex;}
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
margin-top: 50px;
}
/* Caption text */
.text {
color: #f2f2f2;
font-size: 15px;
padding: 8px 12px;
position: absolute;
bottom: 8px;
width: 100%;
text-align: center;
}
/* Number text */
.numbertext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
/* Indicators */
.dot {
height: 5px;
width: 5px;
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}
}
/* Responsive design */
@media only screen and (max-width: 300px) {
.text {font-size: 11px;}
}
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="CSS/style2.css" />
<link rel="shortcut icon" href="IMAGES/PNG/favicon.png" />
<head>
<meta charset="utf-8" />
<title>Electrophotonic Engineering</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="slideshow-container">
<div id = "slideshow" class="mySlides fade">
<div><img src="IMAGES/PNG/background.png"></div>
<div class="text"> Test Text Here </div>
</div>
<div class="mySlides fade">
<img src="IMAGES/PNG/waterfall.png" style="width:100%">
<div class="text">Insert Caption Here</div>
</div>
<div class="mySlides fade">
<img src="IMAGES/PNG/bridge.png" style="width:100%">
<div class="text">Insert Another Caption Here</div>
</div>
</div>
<br>
<div style="text-align:center">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<div class="content" ></div>
<script type="text/javascript" src="JS/sticky_navbar.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>