-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript.js
46 lines (35 loc) · 1.1 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
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
document.getElementById('contact-form').addEventListener('submit', function(e) {
e.preventDefault();
const name = e.target.name.value;
const email = e.target.email.value;
const message = e.target.message.value;
if (name && email && message) {
alert('Thank you for your message!');
e.target.reset();
} else {
alert('Please fill in all fields.');
}
});
document.addEventListener("DOMContentLoaded", function() {
});
let slideIndex = 0;
const slides = document.querySelectorAll('.slide');
const totalSlides = slides.length;
function showSlides() {
slides.forEach(slide => slide.style.display = 'none');
slideIndex++;
if (slideIndex > totalSlides) {
slideIndex = 1;
}
slides[slideIndex - 1].style.display = 'block';
}
setInterval(showSlides, 3000);
showSlides();