gpt4 book ai didi

jQuery Mobile - 切换方向时的空白

转载 作者:行者123 更新时间:2023-12-01 00:15:54 25 4
gpt4 key购买 nike

使用 iPhone 时遇到 jQuery Mobile 问题。当我首先加载页面时,它加载得很好,但是一旦我切换方向,它就会在背景图像的底部添加空白。

在方向样式表中,我只有背景图像的代码。有谁知道如何将纵向高度“固定”为 420px 和横向高度“固定”为 320px 吗?

谢谢。

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd"><head>
<title>Mobile Website</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>

<link rel="stylesheet" media="all and (orientation:portrait)" href="css/portrait.css">
<link rel="stylesheet" media="all and (orientation:landscape)"href="css/landscape.css">

</head>

<body>
</body>
</html>

最佳答案

取出width=device-width并直接使用

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0">

编辑:我遇到了同样的问题并使用了上面的方法。但是,我没有您所拥有的不同 css。

编辑2:试试这个并摆脱 2 个不同的 css 文件,只使用一个没有 all 和orientation 的东西。然后也使用我发布的元 View 内容。我刚刚测试过,这对我有用。无论我使用什么方向,它都会使背景图像保持完整长度。

.ui-page {
background: url(images/purple.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

关于jQuery Mobile - 切换方向时的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8480210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com