-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.js
More file actions
27 lines (22 loc) · 790 Bytes
/
main.js
File metadata and controls
27 lines (22 loc) · 790 Bytes
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
let current_step;
document.addEventListener("DOMContentLoaded", () => {
current_step = document.localStorage.getItem("current_step");
console.log("Current step:", current_step);
});
document.addEventListener("click", (event) => {
event.preventDefault();
console.log("Clicked:", event.target);
const class_list = event.target.classList;
const next_button = class_list.contains("next");
const prev_button = class_list.contains("prev");
if (next_button) {
current_step++;
} else if (prev_button) {
current_step--;
}
document.localStorage.setItem("current_step", current_step);
document.querySelectorAll(".step").forEach((step, index) => {
step.classList.toggle("active", index === current_step);
});
console.log("Current step:", current_step);
});