Skip to content

Commit ef6fcbb

Browse files
author
Greg Pfaff
committed
adding Carousel update
1 parent a2bee95 commit ef6fcbb

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Carousel/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
const buttons = document.querySelectorAll('.page');
2-
1+
const buttons = [].slice.call(document.querySelectorAll('.page'));
2+
let active = false;
33

44
const activeButtons = (e) => {
5-
let active = false;
65
console.log("i hate js")
76
console.log(active);
87
if (active == true) {
9-
for (var i = 0; i < buttons.length; i++) {
10-
buttons[i].classList.remove('active');
11-
}
8+
buttons.forEach(button => button.classList.remove('active'));
9+
}
1210
const target = e.target;
1311
target.classList.add('active');
14-
15-
}
1612
active = true;
1713
}
1814

0 commit comments

Comments
 (0)