我想用jQuery Mobile創建一個標籤頁的移動頁面。我已經掌握了創建選項卡的基礎知識(例如Tab1,Tab2,Tab3,Tab4),並讓每個選項卡加載一個新的內容頁面。 我的問題是我將如何去使用特定標籤內的錨點?因此,例如,如果有人想將鏈接添加到Tab4 Anchor1的鏈接。jQuery Mobile Tabs and Anchors
我是JavaScript和jQuery的新手。任何幫助,將不勝感激。
感謝
下面的代碼:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css">
<!-- JavaScript HTML requirements -->
<script src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
</head>
<body>
<div data-role="page" data-theme="d" id="home" data-id="nav">
<header data-role="header" >
<h1>TEST</h1>
<div data-role="navbar" data-id="nav">
<ul>
<li><a href="#home" data-icon="home" data-theme="d" class="ui-btn-active ui-state-persist" >Home</a></li>
<li><a href="#speakers" data-icon="star" data-theme="d">Speakers</a></li>
<li><a href="#" data-icon="grid" data-theme="d">News</a></li>
</ul>
</div>
</header>
<section data-role="content"> Home </section>
<footer data-role="footer" class="ui-bar"> <a href="" data-icon="gear" class="ui-btn-right">Buy Tickets</a> </footer>
</div>
<div data-role="page" data-theme="d" id="speakers">
<header data-role="header" data-id="nav" >
<h1>TEST</h1>
<div data-role="navbar" >
<ul>
<li><a href="#home" data-icon="home" data-theme="d">Home</a></li>
<li><a href="#speakers" data-icon="star" data-theme="d"
class="ui-btn-active ui-state-persist">Speakers</a></li>
<li><a href="#" data-icon="grid" data-theme="d">News</a></li>
</ul>
</div>
</header>
<section data-role="content">The name attribute specifies the name of an anchor.
The name <a href="#jib">attribute</a> is used to create a bookmark inside an HTML document.
Note: The upcoming HTML5 standard suggests using the id attribute instead of the name attribute for specifying the name of an anchor. Using the id attribute actually works also for HTML4 in all modern browsers.
Bookmarks are not displayed in any special way. They are invisible to the reader. <a name="jib"></a> Speakers </section>
<footer data-role="footer" class="ui-bar"> <a href="" data-icon="gear" class="ui-btn-right">Buy Tickets</a> </footer>
</div>
</body>
</html>
你現在不能書籤?當我們說一個#jib鏈接被選中並且標籤被顯示時,所提供的Jib頁面的書籤應該是可能的。 – Shenaniganz
從我對jQuery Mobile有限的認識看來,#----指的是將要加載的頁面。例如http:www.url.com/#page1,但問題是我如何直接轉到頁面中間的嵌入式錨點1.是否合理? –