朋友们,我创建了两个第一页是index.html
,第二个是about.html
。我只想使用jQuery mobile在about.html
上添加后退按钮。我已经尝试过,但后退按钮不能在我的代码中工作我不知道是什么问题
HTML
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile-1.2.0.min.css" />
<script src="jquery-1.8.2.min.js"></script>
<script src="jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="data-add-back-btn ">Back</div>
<div><h1>Page title</h1>
<a href="about.html" data-role="button">About us</a></div>
</div>
</body>
</html>
请帮帮我。提前谢谢......
答案 0 :(得分:4)
您可以尝试使用data-rel="back"
创建后退按钮,如下所示:
<a data-role="button" data-rel="back">Back</a>
完整HTML:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile-1.2.0.min.css" />
<script src="jquery-1.8.2.min.js"></script>
<script src="jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page">
<a data-role="button" data-rel="back">Back</a>
<div>
<h1>Page title</h1>
<a href="about.html" data-role="button">About us</a>
</div>
</div>
</body>
</html>
查看在线文档的"Back" button links
部分以获取更多信息:http://jquerymobile.com/demos/1.2.0/docs/pages/page-links.html