无样式(未应用类)页面 jQuery Mobile 简单导航

发布于 2024-10-04 11:45:54 字数 3634 浏览 3 评论 0原文

我创建了一个简单的两页示例,第一页有一个列表视图,第二页只有一个

,但是当第二页加载时,现在会自动应用 ui 样式吗?我是否必须手动调用某些内容,或者我的导航布局是否存在问题?下面的代码非常感谢任何帮助。

索引.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>

第二.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>

I have created a simple two page example, first page has a list view and the second just a <h1>, however when the second page gets loaded there are now ui styles applied to it automatically? Do I have to call something manually or is there an issue with how I've laid out the navigation? Code below any help much appreciated.

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

洒一地阳光 2024-10-11 11:45:54

AFAIK 这就是它的设计目的:当您链接到 HTML 页面时,它会将其正文作为内容插入页眉和页脚的 jQuery 移动上下文之内和之间。如果您想完全控制 HTML,则必须在链接中添加 rel="external",否则它们将通过 AJAX 加载、解析内容并动态插入。

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

AFAIK that's what it's designed to do: when you link to an HTML page it inserts it's body as content within and between the jQuery mobile context of a header and footer. If you want full control of the HTML you have to put rel="external" in your links otherwise they're loaded via AJAX, parsed for content and inserted dynamically.

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

蓝礼 2024-10-11 11:45:54

尝试使用

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

and

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

Try with

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

and

href="second.html?" instead of href="second.html"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文