adventskalender/shared/js/position.js aktualisiert
This commit is contained in:
@@ -83,3 +83,25 @@ document.addEventListener('visibilitychange', () => {
|
||||
setTimeout(positionAllDoors, 200);
|
||||
}
|
||||
});
|
||||
|
||||
// === Zahlen für Flügeltüren (.door-number)
|
||||
document.querySelectorAll('.door-number').forEach(number => {
|
||||
const day = number.dataset.day;
|
||||
const topPct = parseFloat(number.dataset.top) || 0;
|
||||
const leftPct = parseFloat(number.dataset.left) || 0;
|
||||
const widthPct = parseFloat(number.dataset.width) || 12;
|
||||
|
||||
const w = imgRect.width * (widthPct / 100);
|
||||
const h = w * 2;
|
||||
|
||||
number.style.position = 'absolute';
|
||||
number.style.width = `${w}px`;
|
||||
number.style.height = `${h}px`;
|
||||
number.style.top = `${imgRect.top - contRect.top + imgRect.height * (topPct / 100)}px`;
|
||||
number.style.left = `${imgRect.width * (leftPct / 100) + (contRect.width - imgRect.width) / 2}px`;
|
||||
|
||||
number.style.display = 'flex';
|
||||
number.style.alignItems = 'center';
|
||||
number.style.justifyContent = 'center';
|
||||
number.style.pointerEvents = 'none';
|
||||
});
|
||||
Reference in New Issue
Block a user