moved inline javascript to it's own file
This commit is contained in:
parent
5813d200dc
commit
26f3d5d033
2 changed files with 26 additions and 24 deletions
24
community_backup/static/webui/js/webui.js
Normal file
24
community_backup/static/webui/js/webui.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Activation script for the bulma burger menu.
|
||||
// Copied from https://bulma.io/documentation/components/navbar/
|
||||
//
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||
|
||||
// Add a click event on each of them
|
||||
$navbarBurgers.forEach( el => {
|
||||
el.addEventListener('click', () => {
|
||||
|
||||
// Get the target from the "data-target" attribute
|
||||
const target = el.dataset.target;
|
||||
const $target = document.getElementById(target);
|
||||
|
||||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
||||
el.classList.toggle('is-active');
|
||||
$target.classList.toggle('is-active');
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue