adventskalender/shared/js/position.js aktualisiert
This commit is contained in:
@@ -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';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user