resize iframe if view width is smaller than frame

This commit is contained in:
vance 2024-05-02 21:32:43 -07:00
parent aaaf02ba1d
commit 36a8e9ce60

View File

@ -151,6 +151,7 @@
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0); const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0); const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
// resize iframe if view width is smaller than frame
if (document.getElementById('live').width > vw) { if (document.getElementById('live').width > vw) {
document.getElementById('live').width = vw; document.getElementById('live').width = vw;
document.getElementById('live').height = vw * (9 / 16); document.getElementById('live').height = vw * (9 / 16);