-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
65 lines (32 loc) · 1.22 KB
/
main.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const navItems = document.querySelector('.nav_items');
const openNavBtn = document.querySelector('#open_nav-btn');
const closeNavBtn = document.querySelector('#close_nav-btn');
//open nav dropdown
const openNav = () => {
navItems.style.display = 'flex';
openNavBtn.style.display = 'none';
closeNavBtn.style.display = 'inline-block';
}
//close nav dropdown
const closeNav = () => {
navItems.style.display = 'none';
openNavBtn.style.display = 'inline-block';
closeNavBtn.style.display = 'none';
}
openNavBtn.addEventListener('click', openNav);
closeNavBtn.addEventListener('click', closeNav);
const sidebar = document.querySelector('aside');
const showSideBarBtn = document.querySelector('#show_sidebar-btn');
const hideSideBarBtn = document.querySelector('#hide_sidebar-btn');
const showSideBar = () => {
sidebar.style.left = '0';
showSideBarBtn.style.display = 'none';
hideSideBarBtn.style.display = 'inline-block';
}
const hideSideBar = () => {
sidebar.style.left = '-100%';
showSideBarBtn.style.display = 'inline-block';
hideSideBarBtn.style.display = 'none';
}
showSideBarBtn.addEventListener('click', showSideBar)
hideSideBarBtn.addEventListener('click', hideSideBar)