Purpose

Solve the problem of page confusion and realize large-screen adaptation with multiple resolutions

Simplest implementation

Does not affect the current project, directly wrap a layer outside (you can also adjust the code to the project)

<style>
    body,html{height:100%;overflow: hidden;margin: 0;padding: 0;background-color: #272727;}
    .box{
        width:1920px;
        height:1080px;
        transform:scale(1,1);
        transform-origin:left top;
        background-image: url(img/1920-1080.jpg);
        background-repeat: no-repeat;
        background-color: #000;
    }
    .box iframe{
        width:100%;
        height:100%;
        border:none;
    }
</style>

<div id="app" class="box">
    <iframe src="https://www.elephdev.com"></iframe>
</div>

<script>
    !function resizeScale(id){
        var dom = document.getElementById(id);
        var domW = dom.clientWidth;
        var domH = dom.clientHeight;
        setScale();
        window.addEventListener('resize',function(){
            setScale();
        },false);
        function setScale(){
            var winW = window.innerWidth,
                winH = window.innerHeight,
                scaleX = winW/domW,
                scaleY = winH/domH;
            dom.style.transform ='scale('+ scaleX +','+ scaleY +')';
        }
    }('app');
</script>
点赞(0)

评论列表 共有 0 评论

暂无评论

微信服务号

微信客服

淘宝店铺

support@elephdev.com

发表
评论
Go
顶部