diff --git a/index.html b/index.html index 5601ae0..b15224f 100644 --- a/index.html +++ b/index.html @@ -565,6 +565,32 @@ + +
+ + + + + +

Our Numbers

@@ -601,6 +627,9 @@
+ + + + + + \ No newline at end of file diff --git a/slider.html b/slider.html index 3ccc4df..516594e 100644 --- a/slider.html +++ b/slider.html @@ -1,5 +1,22 @@ +
+
+
+
+
+
+
+
+
+ + + + +
+
+ - -
-
-
-
-
-
-
-
-
- - + \ No newline at end of file + } + + nextSlide() { + this.currentIndex = (this.currentIndex + 1) % this.totalSlides; + this.updateSlider(); + } + + prevSlide() { + this.currentIndex = this.currentIndex === 0 ? this.totalSlides - 1 : this.currentIndex - 1; + this.updateSlider(); + } + + goToSlide(index) { + this.currentIndex = index; + this.updateSlider(); + } + + startAutoPlay() { + setInterval(() => { + this.nextSlide(); + }, 4000); + } + + bindEvents() { + this.nextBtn.addEventListener('click', () => this.nextSlide()); + this.prevBtn.addEventListener('click', () => this.prevSlide()); + + let startX = 0; + this.track.addEventListener('touchstart', (e) => { + startX = e.touches[0].clientX; + }); + + this.track.addEventListener('touchend', (e) => { + const endX = e.changedTouches[0].clientX; + const diff = startX - endX; + + if (Math.abs(diff) > 50) { + if (diff > 0) this.nextSlide(); + else this.prevSlide(); + } + }); + } + } + + new SimpleSlider(); + } +