data-position="fixed" data-tap-toggle="false"
置顶置底:解决点击造成的(顶)header与(底)footer消失至头部和尾部
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,target-densitydpi=high-dpi]">-->
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="css/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet"
href="css/jquery.mobile.structure-1.4.2.min.css">
<link rel="stylesheet" href="css/jquery.mobile.theme-1.4.2.min.css">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.4.2.min.js"></script>
<style type="text/css">
.ui-page {
backface-visibility:hidden;
-webkit-backface-visibility:hidden;
-moz-backface-visibility:hidden;
}
</style>
<script type="text/javascript">
function aa() {
showLoader();
$.post("3g/ifm/newsList.spr", {}, function(data) {
$("#content").html(data);
$("#content").trigger('create');
$("#first").addClass("ui-btn-active ui-state-persist");
hideLoader();
});
}
function showLoader() {
//显示加载器.for jQuery Mobile 1.2.0
$.mobile.loading('show', {
text : '加载中...', //加载器中显示的文字
textVisible : true, //是否显示文字
theme : 'a', //加载器主题样式a-e
textonly : false, //是否只显示文字
html : "" //要显示的html内容,如图片等
});
}
//隐藏加载器.for jQuery Mobile 1.2.0
function hideLoader() {
//隐藏加载器
$.mobile.loading('hide');
}
// $(document).bind("mobileinit", function() {
// $.mobile.page.prototype.options.addBackBtn = true;
//});
</script>
</head>
<body>
<div data-role="page" id="homePage" data-theme="b" data-fullscreen="true" >
<div data-role="header" data-position="fixed" data-tap-toggle="false">
<h1>
欢迎来到..... </h1>
<div data-role="navbar">
<ul>
<li>
<a id="first" href="javascript:aa()" data-icon="home"
data-transition="none" data-inline="true">首页</a>
</li>
<li>
<a href="#" data-icon="star">資訊</a>
</li>
<li>
<a href="#" data-icon="search">搜索</a>
</li>
<li>
<a href="#" data-icon="search">搜索</a>
</li>
</ul>
</div>
</div>
<div data-role="content" id="content">
<p>
<b>提示:</b>如果要看到效果,则需要调整窗口大小使滚动条可用。
</p>
<p>
<b>提示:</b>如果滚动条可用,那么敲击屏幕将隐藏或显示页眉/页脚。效果会根据您在页面上的位置而变化。
</p>
</div>
<div data-role="footer" data-position="fixed" data-tap-toggle="false" >
<h1>
Fixed 页脚
</h1>
</div>
</div>
</body>
</html>