无样式(未应用类)页面 jQuery Mobile 简单导航
我创建了一个简单的两页示例,第一页有一个列表视图,第二页只有一个
,但是当第二页加载时,现在会自动应用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这实际上是一个已知错误,并在提交中修复 https://github.com/jquery/jquery -移动/提交/80d56e655bac8aa6205a0c1f5a9877493a5ced71
This was actually a know bug and fixed in commit https://github.com/jquery/jquery-mobile/commit/80d56e655bac8aa6205a0c1f5a9877493a5ced71
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
尝试使用
and
Try with
and