0
A
回答
3
最簡單的方法是利用jQuery Mobile項目以及一些最佳實踐CSS的高度和一些額外的腳本。
這裏有一個基本的鍋爐板供您使用。
<!DOCTYPE html>
<html>
<head>
<meta content='yes' name='apple-mobile-web-app-capable'>
<meta content='default' name='apple-mobile-web-app-status-bar-style'>
<meta content='width=device-width, minimum-scale=1.0, maximum-scale=1.0' name='viewport'>
<title>Example jQuery Mobile/Full-Height Content</title>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js' type='text/javascript'></script>
<script src='http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js' type='text/javascript'></script>
<style>
@media screen and (orientation: landscape) {
html, body {
width: 100%;
}
.content h1.landscape { display: block }
.content h1.portrait { display: none }
}
@media screen and (orientation: portrait) {
html, body {
width: 100%;
}
.content .landscape { display: none }
.content .portrait { display: block }
}
</style>
<link href='http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css' rel='stylesheet'>
</head>
<body>
<div data-role='page' data-theme='a'>
<div class='header' data-role='header'>
<h1>header</h1>
</div>
<div class='content' data-role='content'>
<h1 class="landscape">landscape!</h1>
<h1 class="portrait">portrait!</h1>
</div>
<div class='footer' data-role='footer'>
Nothing to see here.
</div>
</div>
<script>
(function() {
var fixgeometry = function() {
/* Some orientation changes leave the scroll position at something
* that isn't 0,0. This is annoying for user experience. */
scroll(0, 0);
/* Calculate the geometry that our content area should take */
var header = $(".header:visible");
var footer = $(".footer:visible");
var content = $(".content:visible");
var viewport_height = $(window).height();
var content_height = viewport_height - header.outerHeight() - footer.outerHeight();
/* Trim margin/border/padding height */
content_height -= (content.outerHeight() - content.height());
content.height(content_height);
}; /* fixgeometry */
$(document).ready(function() {
$(window).bind("orientationchange resize pageshow", fixgeometry);
});
})();
</script>
</body>
</html>
希望這可以幫助你開始。
相關問題
- 1. 垂直滾動的1024 * 768分辨率
- 2. 以小瀏覽器分辨率垂直居中Flash網站
- 3. 垂直對齊不適用於所有屏幕分辨率
- 4. 網絡攝像頭分辨率問題
- 5. 如何自動縮放網頁取決於分辨率
- 6. 如何中心 - 所有的屏幕分辨率垂直菜單?
- 7. 用於WXGA分辨率的UI縮放
- 8. 在所有分辨率下垂直居中圖像
- 9. 如何盲目地更改Dune網絡媒體播放器的分辨率?
- 10. 垂直放置TabControl
- 11. 如何使DataGrid將內容縮放到任何分辨率?
- 12. 如何在CocosSharp(Android)中將CCSprite縮放爲任何分辨率?
- 13. 取決於屏幕分辨率的CSS圖像放置方式
- 14. Flex 4.5 for mobile:在高分辨率圖像上縮放
- 15. 在中心垂直放置網格?
- 16. 如何刷新java中網絡名稱的分辨率?
- 17. 網站分辨率問題
- 18. UIGraphicsGetImageFromCurrentImageContext()視網膜分辨率?
- 19. 網站分辨率修復Javascript中的所有分辨率
- 20. 網站屏幕分辨率自動分辨率
- 21. IPad視網膜分辨率與正常分辨率
- 22. CSS/HTML適合任何分辨率
- 23. 適合任何屏幕分辨率
- 24. 如何適應網站的內容在任何分辨率CSS
- 25. 當分辨率小於
- 26. 用於超分辨率的Tensorflow的可變分辨率
- 27. Integrateing網絡Aplication到用戶網站
- 28. 如何在任何屏幕分辨率上將網頁內容設置爲100%?
- 29. Camera.setMode設置小分辨率
- 30. 設置分辨率xrandr --addmode
這對你有幫助嗎? – 2011-06-08 21:53:05