Update js/main.js, index.html

This commit is contained in:
XenGi 2022-02-08 22:15:50 +00:00
commit 0c70662823
2 changed files with 37 additions and 4 deletions

View file

@ -14,3 +14,17 @@ function gototop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
document.addEventListener('DOMContentLoaded', function() {
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
if ($navbarBurgers.length > 0) {
$navbarBurgers.forEach(function(el) {
el.addEventListener('click', function() {
const target = el.dataset.target;
const $target = document.getElementById(target);
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
});