blob: 614a94825473dd87cedc95f39943b6ff3897de5a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
const expandBtn = document.getElementById('expandNavbarBtn');
const sidebarElem = document.getElementById('sidebar');
if (localStorage.getItem('navbar') === 'hidden' || window.innerWidth <= 610) {
expandBtn.innerText = '\u25BC';
sidebarElem.classList.add('sidebar-hidden');
}
expandBtn.onclick = function() {
sidebarElem.classList.toggle('sidebar-hidden');
if (!sidebarElem.classList.contains('sidebar-hidden')) {
expandBtn.innerText = '\u25B2'; // triangle pointing up
if (window.innerWidth > 610) localStorage.setItem('navbar', 'norm');
}
else {
expandBtn.innerText = '\u25BC'; // triangle pointing down
if (window.innerWidth > 610) localStorage.setItem('navbar', 'hidden');
}
}
|