forked from Adleraci/adlerka.top
Test JS
This commit is contained in:
parent
b698f9e284
commit
c4c9e021e4
@ -134,10 +134,17 @@ async function doPageAction(requestData, wantsReturn = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initAjax() {
|
async function initAjaxNavigationEvents(){
|
||||||
const links = document.querySelectorAll('.navsite_link, .navpage_link');
|
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) {
|
link.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let site = this.dataset.site;
|
let site = this.dataset.site;
|
||||||
@ -153,6 +160,11 @@ async function initAjax() {
|
|||||||
toggleButton.addEventListener('click', () => {
|
toggleButton.addEventListener('click', () => {
|
||||||
navLinks.classList.toggle("active")
|
navLinks.classList.toggle("active")
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initAjax() {
|
||||||
|
|
||||||
|
await initAjaxNavigationEvents();
|
||||||
await onPageLoad();
|
await onPageLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user