var pulleys = document.getElementsByClassName("pullable");
pulleys.forEach((pulley) => {
pulley.addEventListener("click", () => {
if (pulley.classList.contains("trigger")) {
togglePulley();
}
});
});
I am trying to iterate through this and I have dom.iterable in my tsconfig but the “foreach” still does not work. What else can I do? When I convert it to an array or use queryselectall, the elements aren’t live/getting updated anymore.
function togglePulley() {
if (contents && container && pull) {
if (contents.style.height != "0px") {
container.classList.add("trigger");
pull.classList.remove("trigger");
contents.style.height = "0px";
contents.style.padding = "0px";
container.style.height = "unset";
container.style.position = "static";
container.style.margin = "1em 0";
} else {
container.classList.remove("trigger");
pull.classList.add("trigger");
contents.style.height = "100%";
contents.style.maxHeight = "100vh";
contents.style.padding = "2rem 0";
container.style.margin = "auto";
container.style.height = "100%";
container.style.position = "absolute";
}
}
}