-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (30 loc) · 1.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
document.getElementById('startButton').addEventListener('click', function(event) {
event.preventDefault();
const targetElement = document.getElementById('start');
targetElement.scrollIntoView({ behavior: 'smooth' });
});
const carousel = document.getElementById('carousel');
const images = [
"sumama.jpeg",
"sardar.png",
"zubayer.png",
"adam.png",
"mahidul.png",
"faiyaz.png",
"samen.png",
"jojo.png"
];
const numberOfImages = images.length;
let currentImageIndex = 0;
function updateCarousel() {
const previousIndex = (currentImageIndex - 1 + numberOfImages) % numberOfImages;
const nextIndex = (currentImageIndex + 1) % numberOfImages;
document.getElementById('previous').children[0].src = images[previousIndex];
document.getElementById('current').children[0].src = images[currentImageIndex];
document.getElementById('next').children[0].src = images[nextIndex];
}
setInterval(() => {
currentImageIndex = (currentImageIndex + 1) % numberOfImages;
updateCarousel();
}, 4000);
updateCarousel();