diff --git a/package.json b/package.json index 7b8cb63..710bf46 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@leuffen/liscom-loader", - "version": "1.0.7", + "version": "1.0.8", "description": "", "main": "./dist/index.js", "module": "./dist/index.js", diff --git a/src/loader/loader.ts b/src/loader/loader.ts index 3a322c6..2e77ce6 100755 --- a/src/loader/loader.ts +++ b/src/loader/loader.ts @@ -16,12 +16,18 @@ export function initLoader() { // Cancel interval clearInterval(interval); - let img = document.querySelector("img")?.cloneNode(true) as HTMLImageElement; + + let img = document.querySelector("img.loader-image")?.cloneNode(true) as HTMLImageElement; + if (img === undefined) { + img = document.querySelector("img")?.cloneNode(true) as HTMLImageElement; + } if (img === undefined) { console.warn("[liscom-loader] No image found to use as loader."); return; } + img.classList.remove("d-none"); + let loader = ka_create_element("div", {class: "loader"}); let loaderImg = ka_create_element("div", {class: "loader-img"}, [img], loader); img.setAttribute("class", "");