我想让一张图片覆盖整个手机屏幕。当我在笔记本电脑上使用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>发布于 2019-01-11 07:32:53
#panorama{
background-size: cover ;
} https://stackoverflow.com/questions/54138391
复制相似问题