scale自适应页面

<div id="iframeBox">
    <div class="scale-box">
        <iframe allow-full-screen="true"></iframe>
        <img src="fullScreen.png">
    </div>
</div>
var ifr = document.querySelector("#iframeBox");
var box = ifr.querySelector('.scale-box');
var src = "/screen/?v=" + Math.random() + "#/home/" + (location.searchObj().id || "1") + "/1/";
document.querySelector("iframe").src = src;

function a() {
    var offsetWidth = ifr.offsetWidth,
        offsetHeight = ifr.offsetHeight;
    box.style.transform = scaleX(${offsetWidth / 1920}) scaleY(${offsetHeight / 1080});
}
window.addEventListener('resize', a, false);
a();
document.querySelector("img").onclick = fullScreen;
THE END
分享
二维码
打赏
< <上一篇
下一篇>>