fix(player): resize-Event nach iframe-Einblenden feuern
JS-lastige Seiten (z.B. WebUntis) führen Layout-Berechnungen aus während der iframe noch display:none hat (offsetWidth=0). Ein resize-Event nach der Opacity-Transition triggert einen Neu-Layout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8025946ab7
commit
ba08220ec5
1 changed files with 13 additions and 1 deletions
|
|
@ -464,7 +464,19 @@ const playerHTML = `<!DOCTYPE html>
|
||||||
if (frame.src !== item.src) { frame.src = item.src; }
|
if (frame.src !== item.src) { frame.src = item.src; }
|
||||||
frame.style.display = 'block';
|
frame.style.display = 'block';
|
||||||
requestAnimationFrame(function() {
|
requestAnimationFrame(function() {
|
||||||
requestAnimationFrame(function() { frame.style.opacity = '1'; });
|
requestAnimationFrame(function() {
|
||||||
|
frame.style.opacity = '1';
|
||||||
|
// Nach der Opacity-Transition (500ms) einen Resize-Event feuern,
|
||||||
|
// damit JS-basierte Layouts (z.B. WebUntis) neu berechnen.
|
||||||
|
// Der iframe ist jetzt sichtbar (offsetWidth > 0).
|
||||||
|
setTimeout(function() {
|
||||||
|
try {
|
||||||
|
frame.contentWindow.dispatchEvent(new Event('resize'));
|
||||||
|
} catch (e) {
|
||||||
|
// CORS-Fehler bei cross-origin iframes ignorieren.
|
||||||
|
}
|
||||||
|
}, TRANSITION_MS);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fehler-Fallback wenn iframe-Laden fehlschlägt (z.B. X-Frame-Options).
|
// Fehler-Fallback wenn iframe-Laden fehlschlägt (z.B. X-Frame-Options).
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue