-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
41 lines (30 loc) · 1.03 KB
/
scripts.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
(function () {
const carouselItems = document.querySelectorAll(".portfolio_carousel_item");
const prevButton = document.querySelector(".portfolio_prev_button");
const nextButton = document.querySelector(".portfolio_next_button");
let currentSlide = 0;
function showSlide(n) {
carouselItems[currentSlide].style.display = "none";
currentSlide = (n + carouselItems.length) % carouselItems.length;
carouselItems[currentSlide].style.display = "block";
}
function nextSlide() {
showSlide(currentSlide + 1);
}
function prevSlide() {
showSlide(currentSlide - 1);
}
function updateSlide() {
showSlide(currentSlide);
}
nextButton.addEventListener("click", nextSlide);
prevButton.addEventListener("click", prevSlide);
window.updateSlide = updateSlide;
showSlide(currentSlide);
})();
setInterval(nextSlide, 5000);
var submitButton = document.querySelector(".contacs_form form button");
submitButton.addEventListener("click", function (event) {
event.preventDefault();
alert("Form submitted!");
});