-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
46 lines (38 loc) · 880 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
]
const thisMonth = months[new Date().getMonth()]
function render() {
let output = ""
for (month of months) {
const active = thisMonth == month ? "active" : ""
output = `${output}<div class="${active}">${month}</div>`
}
return output
}
const divMain = app.querySelector("main");
divMain.innerHTML = render();
const divHeader = app.querySelector("header span");
let thisYear = new Date().getFullYear();
divHeader.innerHTML = thisYear;
const iconLeft = document.querySelector(".ph-caret-left");
iconLeft.addEventListener('click', ()=>{
thisYear--
divHeader.innerHTML = thisYear
})
const iconRight = document.querySelector(".ph-caret-right")
iconRight.addEventListener("click", () => {
thisYear++
divHeader.innerHTML = thisYear
})