1

navbarナビゲーションバーを一度定義する必要があるように、「永続的なツールバー」を実装しようとして います。

参照: http://jquerymobile.com/demos/1.2.0/docs/toolbars/footer-persist-a.html

data-id="the same"(各ページで定義する必要があります)

最初に私は自分の開発にまっすぐ入れましたが、うまくいきませんでした.単純なケースでもうまくいかないように見えるので、あらゆる種類の組み合わせを試しました.

次のコードの幅が間違っている可能性があるのは何ですか? Navivagtion は 2 番目のページにつながりますが、そこにはツールバーはありません。

コード:

<body>
<div data-role="page" id="page" data-id="stHedaer>
    <div data-role="header">
        <h1>Page One</h1>
        <div data-role="navbar"  data-position="fixed">
            <ul>
                <li><a href="#p2">page2</a></li>
                <li><a href="#p3">page3</a></li>
            </ul>
        </div>
    </div>
    <div data-role="content"> Page one </div>
    <div data-role="footer">
        <h4>Page Footer</h4>
    </div>
</div>
<div data-role="page" id="p2"  data-id="stHedaer">
    <div data-role="header" >
        <h1>Page Two</h1>
    </div>
    <div data-role="content"> Content </div>
    <div data-role="footer">
        <h4>Page Footer</h4>
    </div>
</div>
<div data-role="page" id="p3"  data-id="stHedaer" >
    <div data-role="header">
        <h1>Page Three</h1>
    </div>
    <div data-role="content"> Content </div>
    <div data-role="footer">
        <h4>Page Footer</h4>
    </div>
</div>
</body>
4

1 に答える 1

0

jQM のドキュメントは注意深く読む必要があります。すべてのページにナビゲーション バーが必要な場合は、すべてのページに配置する必要があります。と:

...data-position="fixed" data-id="footer"...

ヘッダーとフッターのように。

これが実際の例です: http://jsfiddle.net/Gajotres/Beq4H/

<!DOCTYPE html>
<html>
<head>
  <title>Share QR</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>       
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
  <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
  <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>

<body>

  <div data-role="page" id="home">
    <div data-role="header" data-theme="b" data-position="fixed" data-id="footer">
      <a href="#home" data-icon="home" data-iconpos="notext">Home</a>
      <h1>Share QR</h1>
    </div>
    <div data-role="content">
      <p>Hello world!</p>
    </div>
    <div data-role="footer" data-theme="b" data-position="fixed" data-id="footer">
        <div data-role="navbar">
            <ul>
                <li><a href="#about" data-transition="slide">page2</a></li>
                <li><a href="#about" data-transition="slide">page3</a></li>
            </ul>
        </div>
    </div>
  </div>

  <div data-role="page" id="about">
    <div data-role="header" data-theme="b" data-position="fixed" data-id="footer">
      <a href="#home" data-icon="home" data-iconpos="notext">Home</a>
      <h1>About</h1>
      <a href="#home" data-icon="arrow-l" data-rel="back">Back</a> 
    </div>
    <div data-role="content">
      <p>Share your favorite URLs with other mobile phone users through QR codes.</p>
    </div>
    <div data-role="footer" data-theme="b" data-position="fixed" data-id="footer">
        <div data-role="navbar">
            <ul>
                <li><a href="#home" data-transition="slide">page2</a></li>
                <li><a href="#home" data-transition="slide">page3</a></li>
            </ul>
        </div>
    </div>
  </div>

</body>
</html>
于 2013-01-19T18:15:30.250 に答える