-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
42 lines (37 loc) · 1.26 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const dailyButton = document.querySelector("#daily");
const weeklyButton = document.querySelector("#weekly");
const monthlyButton = document.querySelector("#monthly");
const dailyCards = document.querySelectorAll(".daily");
const weeklyCards = document.querySelectorAll(".weekly");
const monthlyCards = document.querySelectorAll(".monthly");
const allCards = document.querySelectorAll(".card_details")
dailyButton.addEventListener("click", ()=>{
//remove show class from all cards
allCards.forEach(card => {
card.classList.remove("show");
})
dailyCards.forEach(dailyCard =>{
dailyCard.classList.add("show");
})
//add show class to all daily cards
});
weeklyButton.addEventListener("click", ()=>{
//remove show class from all cards
allCards.forEach(card => {
card.classList.remove("show");
})
weeklyCards.forEach(weeklyCard =>{
weeklyCard.classList.add("show");
})
//add show class to all daily cards
});
monthlyButton.addEventListener("click", ()=>{
//remove show class from all cards
allCards.forEach(card => {
card.classList.remove("show");
})
monthlyCards.forEach(monthlyCard =>{
monthlyCard.classList.add("show");
})
//add show class to all daily cards
});