-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
38 lines (30 loc) · 1.15 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
const navItems = document.querySelector('.nav_items');
const openNavBtn = document.querySelector('#open_nav-btn');
const closeNavBtn = document.querySelector('#close_nav-btn');
const openNav = () => {
navItems.style.display = 'flex';
openNavBtn.style.display = 'none';
closeNavBtn.style.display = 'inline-block'
}
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);