forked from bgsentayehu/ASA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslide.js
More file actions
22 lines (18 loc) · 806 Bytes
/
Copy pathslide.js
File metadata and controls
22 lines (18 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Get all the images inside the hero-background container
const images = document.querySelectorAll('.hero-background img');
let currentIndex = 0;
// Function to show the next image
function showNextImage() {
// Remove the 'active' class from the current image
images[currentIndex].classList.remove('active');
// Calculate the index of the next image
currentIndex = (currentIndex + 1) % images.length;
// Add the 'active' class to the next image
images[currentIndex].classList.add('active');
}
// Show the first image immediately
images[currentIndex].classList.add('active');
// Start the slideshow after a delay
setTimeout(function() {
setInterval(showNextImage, 4000); // Adjust the delay between images as needed
}, 2000); // Adjust the delay before starting the slideshow as needed