forked from bobbyiliev/introduction-to-bash-scripting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (28 loc) · 1.1 KB
/
index.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
// a little JS for the mobile nav button
var year = new Date().getFullYear();
console.log(year);
document.getElementById("year").innerHTML = year;
if (document.getElementById('nav-mobile-btn')) {
document.getElementById('nav-mobile-btn').addEventListener('click', function () {
if (this.classList.contains('close')) {
document.getElementById('nav').classList.add('hidden');
this.classList.remove('close');
} else {
document.getElementById('nav').classList.remove('hidden');
this.classList.add('close');
}
});
}
// ######################################
// a little JS for the mobile nav button
if (document.getElementById('nav-mobile-btn')) {
document.getElementById('nav-mobile-btn').addEventListener('click', function () {
if (this.classList.contains('close')) {
document.getElementById('nav').classList.add('hidden');
this.classList.remove('close');
} else {
document.getElementById('nav').classList.remove('hidden');
this.classList.add('close');
}
});
}