【发布时间】:2012-12-24 13:30:35
【问题描述】:
我的问题是关于JQM。我目前正在开发一个移动应用程序,其中包括一个固定的页眉和页脚。
在Safari 和Chrome (Mac) 上一切正常,但是当我在iPhone 或iPad Safari 上查看应用程序时,固定的页眉和页脚不会在一开始就停留在顶部。滚动和停止后,页眉和页脚保持不变。
我的来源:
<!DOCTYPE html>
<html>
<head>
<script src="phonegap.js"></script>
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="jquery/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="jquery/jquery.mobile.theme-1.2.0.css" />
<script src="jquery/jquery-1.8.2.min.js"></script>
<script>
$(document).bind("mobileinit", function() {
$.mobile.page.prototype.options.addBackBtn = true;
});
</script>
<script src="jquery/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="master">
<div data-role="header" data-position="fixed" class="header-custom">
<img src="images/logo.png" style="height: 44px;"> <a href="index.html" data-icon="refresh" id="refreshButton" class="ui-btn-right" style="fmargin-top: 4px;" data-iconpos="notext">Aktualisieren</a>
</div>
<!-- /header -->
<div data-role="content">
<ul data-role="listview" id="rssListView"></ul>
</div>
<!-- /content -->
</div>
<!-- /page -->
</body>
</html>
自定义标头类:
/* Custom navbar */
.header-custom {
height: 44px;
background-image: url(images/header.png);
background-size: cover;
}
【问题讨论】:
-
发布的 css 和 html 与您的问题无关。你能发布各自的代码,css和js吗?
-
你指的是哪一部分?其他的只是 JQM 的标准构造。我会更新我的帖子。 -> 我为此找到了一个“修复”,但我对此不太满意。如果我将窗口滚动 1px,标题会刷新并完美运行。 $(document).scrollTop(1);
标签: jquery jquery-mobile header footer css-position