-
Notifications
You must be signed in to change notification settings - Fork 0
/
logic.js
32 lines (31 loc) · 1.21 KB
/
logic.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
var isUp = false;
function toggleTab() {
let nav = document.getElementById("nav-tab");
let tb = document.getElementById("top-bar");
if (window.matchMedia("(orientation: portrait)").matches) {
if(!isUp){
nav.style.transform = "translateY(-500%)";
tb.style.transform = "translateY(-100%)";
document.getElementById("toggleTab").innerHTML = "Show";
isUp = true;
} else {
nav.style.transform = "translateY(-250%)";
tb.style.transform = "translateY(0%)";
document.getElementById("toggleTab").innerHTML = "Hide";
isUp = false;
}
} else if (window.matchMedia("(orientation: landscape)").matches) {
if(!isUp){
nav.style.transform = "translateY(-300%)";
tb.style.transform = "translateY(-100%)";
document.getElementById("toggleTab").innerHTML = "Show";
isUp = true;
} else {
nav.style.transform = "translateY(-100%)";
tb.style.transform = "translateY(0%)";
document.getElementById("toggleTab").innerHTML = "Hide";
isUp = false;
}
}
}
window.DeviceOrientationEvent = () => {toggleTab();}