-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (28 loc) · 1.11 KB
/
app.js
File metadata and controls
33 lines (28 loc) · 1.11 KB
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
29
30
31
32
33
const books= document.querySelectorAll(".book-container");
const filter= document.querySelector(".filter-items");
filter.addEventListener("click",(event)=>{
if (!event.target.classList.contains("active") && event.target.classList.contains("filter-item")) {
document.querySelector(".active").classList.remove("active");
event.target.classList.add("active");
}
const filterValue= event.target.getAttribute("data");
books.forEach(book=>{
if (event.target.classList.contains("filter-item")) {
if (book.classList.contains(filterValue) || filterValue==="All") {
book.classList.remove("hide");
book.classList.add("show");
}else{
book.classList.remove("show");
book.classList.add("hide");
}
}
})
})
profile.addEventListener("click",()=>{
profileModal.classList.toggle("active-modal");
backDrop.classList.toggle("back-drop_active");
})
backDrop.addEventListener("click",()=>{
profileModal.classList.remove("active-modal");
backDrop.classList.remove("back-drop_active");
})