-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
41 lines (34 loc) · 1.19 KB
/
Copy pathmain.js
File metadata and controls
41 lines (34 loc) · 1.19 KB
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
const navItems = document.querySelector('.nav_items');
const openNavBtn = document.querySelector('#open_nav-btn');
const closeNavBtn = document.querySelector('#close_nav-btn');
//open nav
const openNav = () => {
navItems.style.display = 'flex';
openNavBtn.style.display = 'none';
closeNavBtn.style.display = 'inline-block';
};
//close nav
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');
//show sidebar
const showSidebar = () => {
sidebar.style.left = '0';
showSidebarBtn.style.display = 'none';
hideSidebarBtn.style.display = 'inline-block';
};
//hide sidebar
const hideSidebar = () => {
sidebar.style.left = '-100%';
showSidebarBtn.style.display = 'inline-block';
hideSidebarBtn.style.display = 'none';
};
showSidebarBtn.addEventListener('click', showSidebar);
hideSidebarBtn.addEventListener('click', hideSidebar);