-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (26 loc) · 865 Bytes
/
script.js
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
28
let showMoreBtn = document.querySelector(".btn-container");
let text = document.querySelector(".btn__text");
let brandsTablet = document.querySelectorAll(".brands-list__brand--tablet");
let brandsDesk = document.querySelectorAll(".brands-list__brand");
let img = document.querySelector(".btn__img");
showMoreBtn.addEventListener("click", () => {
brandsTablet.forEach((brand) => {
brand.classList.toggle("show-tablet");
});
if (text.innerText == "Показать все") {
text.innerText = "Скрыть";
} else {
text.innerText = "Показать все";
}
brandsDesk.forEach((brand) => {
brand.classList.toggle("show-desktop");
});
changeImage(img);
});
function changeImage(img) {
if (img.src.includes("expand1.svg")) {
img.src = "assets/images/expand.svg";
} else {
img.src = "assets/images/expand1.svg";
}
}