-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
51 lines (45 loc) · 1.16 KB
/
script.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
document.addEventListener("DOMContentLoaded", function() {
const element = document.getElementById("top");
if (element) {
element.scrollIntoView({ behavior: "smooth" });
}
const images = [
'images/1.jpeg',
'images/2.jpeg',
'images/3.jpeg',
'images/4.jpeg',
'images/5.jpeg',
'images/6.jpeg',
'images/7.jpeg',
'images/8.jpeg',
'images/9.jpeg',
'images/10.jpeg',
'images/11.jpeg',
'images/12.jpeg',
'images/13.jpeg',
'images/14.jpeg',
'images/15.jpeg',
];
let currentIndex = 0;
const victimsImg = document.getElementById('victims');
const prevBtn = document.getElementById('prev');
const nextBtn = document.getElementById('next');
function updateImage() {
victimsImg.src = images[currentIndex];
prevBtn.disabled = currentIndex === 0;
nextBtn.disabled = currentIndex === images.length - 1;
}
prevBtn.addEventListener('click', function() {
if (currentIndex > 0) {
currentIndex--;
updateImage();
}
});
nextBtn.addEventListener('click', function() {
if (currentIndex < images.length - 1) {
currentIndex++;
updateImage();
}
});
updateImage();
});