30 lines
993 B
JavaScript
30 lines
993 B
JavaScript
// Show button on scroll
|
|
window.onscroll = function() { toggle_gototop() };
|
|
|
|
function toggle_gototop() {
|
|
gototop_button = document.getElementById("gototop");
|
|
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
|
gototop_button.style.display = "block";
|
|
} else {
|
|
gototop_button.style.display = "none";
|
|
}
|
|
}
|
|
|
|
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');
|
|
});
|
|
});
|
|
}
|
|
});
|