簡體   English   中英

圖片無法覆蓋手機的全屏

[英]An image cannot cover the full screen of a mobile phone

我想讓圖像覆蓋手機的整個屏幕。 當我在筆記本電腦上的iPhone上預覽時,圖像無法覆蓋全屏,而只能覆蓋iPhone屏幕的一小部分。 以下是我的代碼。

<style>
    #panorama {
        width: 100%;
        height: 60vw;
    }
    </style>

</head>
<body>

<div id="panorama"></div>
<script>
    var image = "images/ttu-wbb.jpg";
    if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){
        image = "images/ttu-wbb-m.jpg";
        var mobileDim = document.querySelector("#panorama");
        mobileDim.style.height = "100%";
        mobileDim.style.width = "100%";
    }

    pannellum.viewer('panorama', {
        "type": "equirectangular",
        "panorama": image,
        "autoRotate": -5,
        "autoLoad": true
    });
</script>
#panorama{
    background-size: cover ;
} 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM