使用客户端的jQuery Mobile在多页HTML5 Web应用程序中导航所有页面

问题描述:

我正在使用jQuery Mobile创建WebApp。

I am using jQuery Mobile to create a WebApp.

我有一个这样的页面:

<div data-role="page" id="page1">
    <div data-role="header">
        <p>
            Page 1
        </p>
        <div data-role="navbar">
            <ul>
                <li><a href="#page1">To first</a></li>
                <li><a href="#page2">To second</a></li>
            </ul>
        </div>
     </div>     
</div>
 <div data-role="page" id="page2">
    <div data-role="header">
        <p>
            Page 2
        </p>
        <div data-role="navbar">
            <ul>
                <li><a href="#page1">To first</a></li>
                <li><a href="#page2">To second</a></li>
            </ul>
        </div>
     </div>
</div>

现场演示位于 http://jsfiddle.net/FB9KJ/

它工作正常,但我不想重复< div data-role =navbar> 。

It's working ok, but I don't want to repeat <div data-role="navbar"> for each page.

有没有办法在同一个导航栏上使用所有jQuery Mobile页面?

Are there a way to use the same navbar on all jQuery Mobile pages?

除非您愿意在jsp中使用包含...否则您将不得不接受每个jsp一页。

Not unless you are willing to use includes in a jsp... you will have to settle for one page per jsp though.

OR

使用ANT替换来替换文件中的@ HEADER @ tokens编译时的HTML标记。

use ANT Replace to replace @HEADER@ tokens in your file with HTML Markup at compile time.