From 9e6bf3431f991cb8d23b2d88fe7f5b5b566c2aae Mon Sep 17 00:00:00 2001 From: Thomas Dannenberg Date: Tue, 4 Nov 2025 17:41:52 +0000 Subject: [PATCH] adventskalender/shared/js/position.js aktualisiert --- adventskalender/shared/js/position.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/adventskalender/shared/js/position.js b/adventskalender/shared/js/position.js index 5ed4bf5..c6969fd 100644 --- a/adventskalender/shared/js/position.js +++ b/adventskalender/shared/js/position.js @@ -46,15 +46,22 @@ function positionAllElements() { const leftPct = parseFloat(flugel.dataset.left) || 0; const widthPct = parseFloat(flugel.dataset.width) || 5; - const w = imgRect.width * (widthPct / 100); + const fullW = imgRect.width * (widthPct / 100); + const w = fullW / 2; + const h = fullW; // volle Türhöhe = Breite der gesamten Tür const t = imgRect.top - contRect.top + imgRect.height * (topPct / 100); const l = imgRect.width * (leftPct / 100) + (contRect.width - imgRect.width) / 2; flugel.style.position = 'absolute'; flugel.style.width = w + 'px'; - flugel.style.height = w + 'px'; + flugel.style.height = h + 'px'; flugel.style.top = t + 'px'; - flugel.style.left = l + 'px'; + + if (flugel.classList.contains('left')) { + flugel.style.left = l + 'px'; + } else if (flugel.classList.contains('right')) { + flugel.style.left = (l + w) + 'px'; + } }); }