【问题标题】:jQuery Mobile Fixed Header and Footer scroll at the first moment. (Bug?)jQuery Mobile 固定页眉和页脚在第一时刻滚动。 (漏洞?)
【发布时间】:2012-12-24 13:30:35
【问题描述】:

我的问题是关于JQM。我目前正在开发一个移动应用程序,其中包括一个固定的页眉和页脚。 在SafariChrome (Mac) 上一切正常,但是当我在iPhoneiPad 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


【解决方案1】:

解决了。如果我将&lt;h1&gt;&lt;/h1&gt; 元素添加到我的标题中,它可以正常工作,但我不确定JQM 为什么会这样做。这是 JQM 中的错误吗?

【讨论】:

    猜你喜欢
    • 2013-11-06
    • 1970-01-01
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 2012-03-03
    • 2018-01-26
    • 1970-01-01
    相关资源
    最近更新 更多