-
Notifications
You must be signed in to change notification settings - Fork 0
/
navbar.js
33 lines (32 loc) · 1004 Bytes
/
navbar.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
document.getElementById("slv-navbar-expand").onclick = function()
{
let eNavbar = document.getElementById("slv-navbar");
if (!eNavbar.classList.contains("slv-expanded"))
{
eNavbar.classList.add("slv-expanded");
eNavbar.style.width = "auto";
document.querySelector("#slv-navbar-expand svg use").setAttribute("href", "#angles-left-light");
}
else
{
eNavbar.classList.remove("slv-expanded");
eNavbar.style.width = "";
document.querySelector("#slv-navbar-expand svg use").setAttribute("href", "#angles-right-light");
}
};
function slvNavbar_orientate()
{
let eNavbar = document.getElementById("slv-navbar");
if (document.documentElement.clientWidth > document.documentElement.clientHeight)
{
eNavbar.classList.add("slv-sidebar");
eNavbar.classList.remove("slv-topbar");
}
else
{
eNavbar.classList.add("slv-topbar");
eNavbar.classList.remove("slv-sidebar");
}
}
window.addEventListener("resize", slvNavbar_orientate);
slvNavbar_orientate();