您可以使用jQuery Mobile的:
一般的頁面佈局是
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>My Title</h1>
</div><!-- /header -->
<div data-role="content">
<p>Hello world</p>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
,如果您需要在桌面版網頁轉換爲jQuery Mobile的,你需要重寫大部分視圖頁面因大多數組件如 圖像滾動條/滑塊,懸停的顯示子菜單 可能無法在移動版本上正常工作。
或者您可以使用媒體查詢定義的div不同的像素
@media screen and (max-width: 480px) and (orientation: portrait){
/* some CSS here */
/*define css for all divs*/
}
/* #### Mobile Phones Landscape #### */
@media screen and (max-width: 640px) and (orientation: landscape){
/* some CSS here */
/*define css for all divs*/
}
/* #### Mobile Phones Portrait or Landscape #### */
@media screen and (max-width: 640px){
/* some CSS here */
/*define css for all divs*/
}
jQuery Mobile的是不會解決你的問題,視。我沒有看到我的iPhone5上的任何腳本錯誤...看到這個問題/答案︰http://stackoverflow.com/questions/6293511/using-viewport-to-create-a-mobile-friendly-version –