-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
33 lines (24 loc) · 879 Bytes
/
script.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
const navLinks = document.getElementById('nav');
const menu = document.getElementById('menu');
const body = document.getElementById('body');
window.addEventListener('resize', getSize);
menu.addEventListener('click', handleMenu);
let currState = false;
let currScreenWidth = window.innerWidth;
// console.log(Window.resizeTo(window.screen.availWidth))
window.onresize = function () {
currScreenWidth = window.outerWidth;
};
function getSize() {
// console.log(currScreenWidth)
if (currScreenWidth >= 767) navLinks.style.display = 'flex';
if (currScreenWidth < 767) navLinks.style.display = 'none';
}
// console.log(window.outerWidth)
// console.log(currScreenWidth)
// console.log(screen.width)
function handleMenu() {
currState = !currState;
navLinks.style.display = currState ? 'flex' : 'none';
}
// if(currScreenWidth>=767) navLinks.style.display = "flex"