2012-10-23 34 views
1

我使用phonegap和jquery mobile開發的應用程序有一個奇怪的問題: 當應用程序啓動時,風格不適用,但如果我在應用程序內瀏覽然後返回索引,可以看到很好的應用風格。 我應該改變什麼? 這裏是我的index.html代碼:風格不適用於應用程序啓動

<!DOCTYPE html> 
<html> 
<head> 
<title>Home</title> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=10.0"> 
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script> 
<script type="text/javascript" charset="utf-8"> 

var pictureSource; // picture source 
var destinationType; // sets the format of returned value 
var intervalloRefresh; 
var intervalloRisultati; 
var iter=0; 

// Wait for Cordova to connect with the device 
// 
document.addEventListener("deviceready",onDeviceReady,false); 

// Cordova is ready to be used! 
// 
function onDeviceReady() { 
    pictureSource=navigator.camera.PictureSourceType; 
    destinationType=navigator.camera.DestinationType; 
} 

</script> 
<script type="text/javascript" src="jquery/jquery-1.5.2.min.js"></script> 
<!-- <script type="text/javascript" src="main.js"></script> --> 
<script type="text/javascript" src="jquery/jquery.mobile-1.1.1.js"></script> 
<link rel="stylesheet" type="text/css" href="jquery.css" /> 
<link rel="stylesheet" type="text/css" href="style.css" /> 
<style> 
    #pulsantiera{width:25%;height:100%;float:left;} 
</style> 
</head> 
<body> 
<div data-role="page"> 
     <div data-role="content"> 
     <div id="pulsantiera" data-role="controlgroup" data-type="vertical"> 
      <!-- <a href="javascript:void(0)" data-role="button" onclick="capturePhoto();">Allineamento</a> --> 
      <a href="javascript:void(0)" data-role="button" onclick="allinea();">Allinea</a> 
      <a href="percorsi.html" data-role="button">Percorsi</a> 
      <a href="programma.html" data-role="button">Programma</a> 
      <a href="video.html" data-role="button">Info</a> 
      <a href="javascript:void(0)" data-role="button" onclick="capturePhoto();">Foto</a> 
      <a href="chat.html" data-role="button">Chat</a> 
      <a href="javascript:void(0)" data-role="button" onclick="vote('y');">Y</a> 
      <a href="javascript:void(0)" data-role="button" onclick="vote('a');">A</a> 
      <a href="javascript:void(0)" data-role="button" onclick="vote('n');">N</a> 
     </div> 
     <div style="width:74%;height:100%;margin-left:26%" > 
      <h1 id="title">PATH</h1> 
      <div id="content"> 
       <img src="images/IT_MAPPA.jpg"> 
      </div> 
      <div id="vote" stle="display:none"></div> 
     </div> 
     </div> 
</div> 

</body> 
</html> 

回答

0

您是否嘗試切換你的CSS和JS文件的位置?

如果解析從上到下:

1) jquery is initialized 
2) jquery mobile is initialized 
3) then the CSS is loaded 

所以所需JQM小部件的CSS是不存在的,當JQM踢成齒輪。

嘗試切換到:

1) all CSS 
2) jquery 
3) jquery mobile 

另外,還要檢查JQM page template。 CSS總是先走。

+0

謝謝。我試着按照你的說法切換,但沒有成功。 最後我用了一個把戲: 1.載入一個空白頁面,載入所有樣式 2.載入更改頁面到我的真實索引 現在它工作。也許是一個與HW有關的問題? 我的平板電腦是Motorola Xoom2和Samsung Galaxy P7500 – luca3003