Skip to content

Commit

Permalink
fix carousel js
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed Aug 26, 2024
1 parent 8f40a0e commit 1442da5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ddlh/static/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const statAnimationTime = 1000.0;

class Carousel {
constructor(element) {
this.container = element;
this.container = element.querySelector(".documents");
this.outer = element;
this.currentIndex = 0;
this.setupListeners();
this.updatePosition();
Expand Down Expand Up @@ -48,14 +49,14 @@ class Carousel {
xDelta = 0;
this.updatePosition();
});
this.container
.querySelect(".carousel-shadow.left")
this.outer
.querySelector(".carousel-shadow.left")
.addEventListener("click", (event) => {
this.currentIndex = this.currentIndex - 1;
this.updatePosition();
});
this.container
.querySelect(".carousel-shadow.right")
this.outer
.querySelector(".carousel-shadow.right")
.addEventListener("click", (event) => {
this.currentIndex = this.currentIndex + 1;
this.updatePosition();
Expand Down Expand Up @@ -112,7 +113,7 @@ function animateStat(element) {
}

const setupCarousels = () => {
document.querySelectorAll(".carousel .documents").forEach((container) => {
document.querySelectorAll(".carousel").forEach((container) => {
new Carousel(container);
});
};
Expand Down

0 comments on commit 1442da5

Please sign in to comment.