-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
30 lines (25 loc) · 1.04 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
let slideIndex = 0;
showSlides();
function plusSlides(n) {
showSlides(slideIndex += n);//slideIndex=slideIndex+n
}
function showSlides() {
let i;
let slides = document.getElementsByClassName("slide");
if (slideIndex >= slides.length) { slideIndex = 0 }
// If the slideIndex goes beyond the last slide
// (exceeds the length of the slides array), it resets to the first slide (index 0).
if (slideIndex < 0) { slideIndex = slides.length - 1 }
// If the slideIndex goes below 0 (before the first slide),
//it wraps around to the last slide by setting slideIndex to slides.length - 1.
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slides[slideIndex].style.display = "block";
}
const contactButton = document.querySelector('.contact-button');
contactButton.addEventListener('click', function(e) {
e.preventDefault();
const footer = document.getElementById('footer');
footer.scrollIntoView({ behavior: 'smooth' });
});