forked from jgthms/bulma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
navbar.js
26 lines (22 loc) · 923 Bytes
/
navbar.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
document.addEventListener('DOMContentLoaded', () => {
const rootEl = document.documentElement;
const navbarTopEl = document.getElementById('navbar');
const navbarBottomEl = document.getElementById('navbarBottom');
const fixBottomEl = document.getElementById('navbarFixBottom');
const fixBottomElText = document.getElementById('navbarFixBottomText');
let fixedBottom = false;
fixBottomEl.addEventListener('click', event => {
fixedBottom = !fixedBottom;
if (fixedBottom) {
fixBottomEl.className = 'button is-success';
fixBottomElText.innerHTML = 'Hide';
rootEl.classList.add('has-navbar-fixed-bottom');
navbarBottomEl.classList.remove('is-hidden');
} else {
fixBottomEl.className = 'button is-link';
fixBottomElText.innerHTML = 'Show';
rootEl.classList.remove('has-navbar-fixed-bottom');
navbarBottomEl.classList.add('is-hidden');
}
});
});