在我的jQuery手機(1.2版)網站,我有幾個單獨的頁面(即每個頁面有一個標題,內容和頁腳)。問題是我無法鏈接頁面。以下行不起作用。 <a href="anotherpage.html">Another Page</a>
顯示「Error loading page」。jQuery手機頁面鏈接不工作
如果我將rel="external"
添加到<a>
元素,它將起作用。但是,它會通過Ajax關閉自動加載。但我想使用Ajax加載以及將頁面分開。只是想知道是否有可能。
代碼頁1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Single page template</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"> </script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page 1</h1>
</div>
<div data-role="content">
<a href="b.html"> click me</a>
</div>
<div data-role="footer">
<h4>Footer content</h4>
</div>
</div>
</body>
</html>
代碼頁2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Single page template</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"> </script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page 2</h1>
</div>
<div data-role="content">
page 2 content
</div>
<div data-role="footer">
<h4>Footer content</h4>
</div>
</div>
</body>
</html>
你確定你的頁面層次結構是正確的?或者,你可以嘗試使用絕對網址 – adamdehaven
向我們展示您的頁面示例。這僅僅是不夠的。 – Gajotres
當您點擊鏈接時,您的地址欄中的網址是您期望的網址?即它試圖鏈接到一個子目錄或其他東西,但你想要的文件是在根?想不到更合乎邏輯的解釋... – Mike