This commit is contained in:
Bruno Rybársky 2024-02-07 18:17:38 +01:00
parent b698f9e284
commit c4c9e021e4

@ -134,10 +134,17 @@ async function doPageAction(requestData, wantsReturn = false) {
}
}
async function initAjax() {
const links = document.querySelectorAll('.navsite_link, .navpage_link');
async function initAjaxNavigationEvents(){
const allLinks = document.querySelectorAll('.navsite_link, .navpage_link');
const pageLinks = document.querySelectorAll('.navpage_link');
links.forEach(function (link) {
pageLinks.forEach(function (link) {
link.addEventListener('click', function () {
navLinks.classList.remove("active");
});
});
allLinks.forEach(function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
let site = this.dataset.site;
@ -153,6 +160,11 @@ async function initAjax() {
toggleButton.addEventListener('click', () => {
navLinks.classList.toggle("active")
})
}
async function initAjax() {
await initAjaxNavigationEvents();
await onPageLoad();
}