没有样式(没有应用类)页面jQuery Mobile简单导航

时间:2010-11-22 14:33:59

标签: javascript jquery jquery-mobile

我创建了一个简单的两页示例,第一页有一个列表视图,第二页只有<h1>,但是当第二页加载时,现在会自动应用ui样式吗?我是否必须手动调用某些内容,或者我是如何设置导航的?以下代码非常感谢。

的index.html

<!doctype html>
<html lang="en" class="no-js">
<head>
 <meta charset="utf-8">

 <title>Page One</title>

 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css">

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
 <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
<body>
 <div data-role="page" data-theme="a" id="second">
 <div data-role="header">
 <h1 id="logo" class="ui-title">Header</h1>
 </div>

 <div data-role="content">
 <ul data-role="listview" data-inset="true" data-theme="c" data-split-theme="d">
 <li class="ui-li-has-thumb">
 <img class="ui-li-thumb" src="http://jquerymobile.com/demos/1.0a2/docs/lists/images/album-bb.jpg" />
 <h3 class="ui-li-heading">FooBar</h3>
 <p class="ui-li-desc">Progress</p>
 <a href="second.html"></a>
 </li>
 <li class="ui-li-has-thumb">
 <img class="ui-li-thumb" src="http://jquerymobile.com/demos/1.0a2/docs/lists/images/album-bb.jpg" />
 <h3 class="ui-li-heading">FooBar</h3>
 <p class="ui-li-desc">Progress</p>
 <a href="second.html"></a>
 </li>
 </ul>
 </div>

 <div data-role="footer" data-position="fixed">
 <div data-role="navbar" class="ui-glyphish">
 <ul>
 <li><a class="ui-btn-active" id="quickfind" href="index.html" data-icon="custom">QuickFind</a></li>
 <li><a id="lessons" href="lessons.html&ui-page=listview-1" data-icon="custom" data-theme="a">Lessons</a></li>
 <li><a id="progress" href="#" data-icon="custom" data-theme="a">Progress</a></li>
 <li><a id="favs" href="#" data-icon="custom" data-theme="a">Favs</a></li>
 </ul>
 </div>
 </div>
 </div>
</body>
</html>

second.html

<!doctype html>
<html lang="en" class="no-js">
<head>
 <meta charset="utf-8">

 <title>Page Two</title>

 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css">

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
 <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
<body>
 <div data-role="page">
 <div data-role="header">
 <h1 id="logo" class="ui-title">Second</h1>
 </div>

 <div data-role="content">
 <h1>Hello Page Two</h1>
 </div>

 <div data-role="footer" data-position="fixed">
 <div data-role="navbar" class="ui-glyphish">
 <ul>
 <li><a class="ui-btn-active" id="quickfind" href="index.html" data-icon="custom">QuickFind</a></li>
 <li><a id="lessons" href="lessons.html&ui-page=listview-1" data-icon="custom" data-theme="a">Lessons</a></li>
 <li><a id="progress" href="#" data-icon="custom" data-theme="a">Progress</a></li>
 <li><a id="favs" href="#" data-icon="custom" data-theme="a">Favs</a></li>
 </ul>
 </div>
 </div>
 </div>
</body>
</html>

3 个答案:

答案 0 :(得分:1)

这实际上是一个知道错误,并在提交https://github.com/jquery/jquery-mobile/commit/80d56e655bac8aa6205a0c1f5a9877493a5ced71

中修复

答案 1 :(得分:0)

AFAIK就是它的设计目的:当你链接到一个HTML页面时,它将它的主体作为内容插入到页眉和页脚的jQuery移动上下文之内和之间。如果你想完全控制HTML,你必须在你的链接中放置rel =“external”,否则它们将通过AJAX加载,解析内容并动态插入。

http://jquerymobile.com/demos/1.0a2/#docs/pages/docs-pages.html

答案 2 :(得分:0)

尝试

href="index.html?" instead of href="index.html"

href="second.html?" instead of href="second.html"