【发布时间】:2014-05-27 08:46:48
【问题描述】:
jQM 的页脚有问题。 这是演示 jsfiddle: http://jsfiddle.net/lesliez/SenTt/1/
仔细查看页脚丢失并在页面转换前后再次出现。在桌面浏览器上不那么明显,但在移动设备上非常明显(延迟更长)。
请有人帮忙告诉我我做错了什么。谢谢。
我的 HTML:
<!DOCTYPE html><!--HTML5 doctype-->
<html>
<head>
<title>Your New Application</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<style type="text/css">
/* Prevent copy paste for all elements except text fields */
* { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(255, 255, 255, 0); }
input, textarea { -webkit-user-select:text; }
body { background-color:white; color:black }
</style>
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" type="text/css" href="css/custom.css">
<script src='intelxdk.js'></script>
<script type="text/javascript">
/* Intel native bridge is available */
var onDeviceReady=function(){
//hide splash screen
intel.xdk.device.hideSplashScreen();
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
</script>
</head>
<body>
<!-- content goes here-->
<!-- Start of first page -->
<div data-role="page" id="foo">
<div data-role="header" data-position="fixed">
<h1>Foo</h1>
</div><!-- /header -->
<div role="main" class="ui-content">
<p>I'm first in the source order so I'm shown as the page.</p>
<p>View internal page called <a href="#bar" data-transition="slide">bar</a></p>
</div><!-- /content -->
<div data-role="footer" data-position="fixed">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
<!-- Start of second page -->
<div data-role="page" id="bar">
<div data-role="header" data-position="fixed">
<h1>Bar</h1>
</div><!-- /header -->
<div role="main" class="ui-content">
<p>I'm the second in the source order so I'm hidden when the page loads. I'm just shown if a link that references my id is beeing clicked.</p>
<p><a href="#foo" data-transition="slide" data-direction="reverse">Back to foo</a></p>
</div><!-- /content -->
<div data-role="footer" data-position="fixed">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
<script src='js/jquery-1.11.1.min.js'></script>
<script src='js/jquery.mobile-1.4.2.min.js'></script>
</body>
</html>
我的 CSS:
.ui-content {
padding: 0;
position: absolute !important;
top : 40px !important;
right : 0;
bottom : 40px !important;
left : 0 !important;
background:url(http://htc-wallpaper.com/wp-content/uploads/2013/11/bulldog-puppy1.jpg);
background-size:cover;
background-repeat:no-repeat;
}
【问题讨论】:
-
也许尝试通过脚本而不是绝对位置调整您的内容 div。在这里查看奥马尔和我的答案:stackoverflow.com/questions/21552308/…
-
嗨,我也测试了 Omar 的方式,但这导致了我单独发布的另一个问题。感谢您的建议。
标签: jquery html css jquery-mobile