-
Notifications
You must be signed in to change notification settings - Fork 0
/
aa.js
executable file
·37 lines (28 loc) · 909 Bytes
/
aa.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
(function() {
'use strict';
var isOpen = true;
var button = document.querySelector('#expand-navigation');
var wrapper = document.querySelector('.wrapper');
var overlay = document.querySelector('.overlay');
button.addEventListener('click', navigationHandler);
document.addEventListener('click', closeNavigation);
function navigationHandler(event) {
if (event == null) {
event = window.event;
}
event.stopPropagation();
!isOpen ? openNavigation() : closeNavigation();
}
function openNavigation() {
isOpen = true;
button.innerHTML = '-';
wrapper.className = 'wrapper opened';
overlay.className = 'overlay on-overlay';
}
function closeNavigation() {
isOpen = false;
button.innerHTML = '+';
wrapper.className = 'wrapper';
overlay.className = 'overlay';
}
})();