blob: 462c456676973cac1460056a9f51c91ab8089d85 (
plain)
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
|
function mobile_nav_toggle() {
var nav = document.getElementById("nav");
if (nav.style.display == "unset") {
mobile_nav_off();
} else {
mobile_nav_on();
}
}
function mobile_nav_on() {
var nav = document.getElementById("nav");
nav.style.display = "unset";
// Subract mobile nav height from navbar
var mobile_nav = document.getElementsByClassName("mobile-nav")[0];
nav.children[0].style.height = "calc(100vh - " + mobile_nav.clientHeight + "px)";
mobile_nav.style.backgroundColor = "rgb(var(--secondary))";
// Hide content
var content = document.getElementById("content");
content.style.display = "none";
// Align nav and mobile nav by setting
// the <body> flow to column
var body = document.getElementsByTagName("body")[0];
body.style.flexFlow = "column nowrap"
}
// Undo all changes in mobile_nav_on()
function mobile_nav_off() {
var nav = document.getElementById("nav");
nav.style.display = "";
var mobile_nav = document.getElementsByClassName("mobile-nav")[0];
nav.children[0].style.height = "";
mobile_nav.style.backgroundColor = "";
var content = document.getElementById("content");
content.style.display = "";
var body = document.getElementsByTagName("body")[0];
body.style.flexFlow = ""
}
|