add a little timeout to the delayed cw thing

it seems like sometimes the load handlers are processed before the
image is actually switched
This commit is contained in:
rhiannon morris 2024-08-05 21:31:47 +02:00
parent f8ce4a9362
commit 5e64e9ea1b
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,8 @@ function setImage(id: string, src: string, href: string, cw: string): void {
if (curCw && !coverNew) {
// keep old cover until load
mainimg.addEventListener('load', () => openCW(null, curCw), {once: true});
function removeCover() { setTimeout(() => openCW(null, curCw!), 100); }
mainimg.addEventListener('load', removeCover, {once: true});
} else if (coverNew) {
// place new cover
const newCw =