Update README.md
Browse files
README.md
CHANGED
@@ -617,4 +617,46 @@ function showSlides(n) {
|
|
617 |
slides[slideIndex-1].style.display = "block";
|
618 |
dots[slideIndex-1].className += " active";
|
619 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
</script>
|
|
|
617 |
slides[slideIndex-1].style.display = "block";
|
618 |
dots[slideIndex-1].className += " active";
|
619 |
}
|
620 |
+
|
621 |
+
document.addEventListener("DOMContentLoaded", function() {
|
622 |
+
let currentSlide = 0;
|
623 |
+
const slides = document.querySelectorAll(".carousel-item");
|
624 |
+
const totalSlides = slides.length;
|
625 |
+
|
626 |
+
document.querySelector(".carousel-control-prev").addEventListener("click", function() {
|
627 |
+
moveSlide(-1);
|
628 |
+
});
|
629 |
+
|
630 |
+
document.querySelector(".carousel-control-next").addEventListener("click", function() {
|
631 |
+
moveSlide(1);
|
632 |
+
});
|
633 |
+
|
634 |
+
function moveSlide(direction) {
|
635 |
+
slides[currentSlide].classList.remove("active");
|
636 |
+
currentSlide = (currentSlide + direction + totalSlides) % totalSlides;
|
637 |
+
slides[currentSlide].classList.add("active");
|
638 |
+
}
|
639 |
+
|
640 |
+
// Initialize first slide as active
|
641 |
+
slides[currentSlide].classList.add("active");
|
642 |
+
|
643 |
+
// Dot navigation
|
644 |
+
const dots = document.querySelectorAll(".dot");
|
645 |
+
dots.forEach((dot, index) => {
|
646 |
+
dot.addEventListener("click", () => {
|
647 |
+
slides[currentSlide].classList.remove("active");
|
648 |
+
currentSlide = index;
|
649 |
+
slides[currentSlide].classList.add("active");
|
650 |
+
updateDots();
|
651 |
+
});
|
652 |
+
});
|
653 |
+
|
654 |
+
function updateDots() {
|
655 |
+
dots.forEach(dot => dot.classList.remove("active"));
|
656 |
+
dots[currentSlide].classList.add("active");
|
657 |
+
}
|
658 |
+
|
659 |
+
// Initialize first dot as active
|
660 |
+
dots[currentSlide].classList.add("active");
|
661 |
+
});
|
662 |
</script>
|