1
0
Fork 0
mirror of https://github.com/Findus23/RPGnotes.git synced 2024-09-19 15:43:45 +02:00

run gallery also if page already finished loading

This commit is contained in:
Lukas Winkler 2023-10-02 23:23:00 +02:00
parent f30be377b1
commit a98909ec33
Signed by: lukas
GPG key ID: 54DE4D798D244853
2 changed files with 16 additions and 4 deletions

View file

@ -1,6 +1,12 @@
import {LuminousGallery} from "luminous-lightbox";
document.addEventListener('DOMContentLoaded', function () {
function initGallery(): void {
const galleries = document.querySelectorAll("a.image-viewer");
new LuminousGallery(galleries)
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initGallery)
} else {
initGallery()
}

View file

@ -14,11 +14,17 @@ import "./js/gallery"
const bootstrapModules = [Collapse, Dropdown]
document.addEventListener('DOMContentLoaded', function () {
function init(): void {
if (document.getElementById("id_description_md")) {
import ("./js/codemirror").then(value => console.log("loaded"))
}
if (document.getElementById("graph")) {
import ("./js/graph").then(value => console.log("graph loaded"))
}
})
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init)
} else {
init()
}