2014-12-05 85 views
1

我試圖使用與jQuery Mobile的,並在Android科爾多瓦文件傳輸顯示的圖像後,jQuery Mobile的頁面中消失的CSS

我使用本教程練習: http://blog.revivalx.com/2014/05/03/tutorial-camera-cordova-plugin-for-ios-and-android/

選擇圖片後,這個功能是成功的呼叫:

function onPhotoDataSuccess(imageURI) { 
    navigator.notification.alert("onPhotoDataSuccess Image URI: "+imageURI, function() {}); 
    var cameraImage = document.getElementById('image'); 
    cameraImage.style.display = 'block'; 
    cameraImage.src = imageURI; 
} 

通知給我好的文件URI,所以我相信這是確定的,但在應用程序回來web視圖,整個「頁面」,它的內容disapp耳朵從屏幕上出現,另一個頁面出現,這個頁面是顯示的啓動頁面,直到設備準備就緒,當它準備好時,我將頁面更改爲登錄頁面。

<div id="launcherPage" data-role="page" data-theme="b"> 
     <h1>Loading...</h1> 
    </div> 

所以,我想和這個代碼改變了這一功能:

function onPhotoDataSuccess(imageURI) { 
    navigator.notification.alert("onPhotoDataSuccess Image URI: "+imageURI, function() {}); 
    $('#image').attr({ 
     src: imageURI, 
     style: "display:block;width:100%;" 
    }); 
} 

但我有相同的結果,不存在重複的ID,我真的不明白爲什麼它這樣做。

下面是HTML代碼:

<div data-role="page" id="picture" data-theme="b"> 
    <div data-role="header"> 
     <h1>TEST</h1> 
    </div><!-- /header --> 
    <div data-role="content" data-theme="b"> 
     <form id="pictureForm"> 
      <button onclick="capturePhoto();">Capture Photo</button><br> 
      <button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo Library</button> 
      <img id="image" src="" style="display:none;width:100%;"> 
      <label for="title">Title</label> 
      <input data-clear-btn="true" name="title" id="title" value="" type="text"> 
      <input value="Continue" type="submit" id="adButton" onclick="uploadPhoto();"> 

     </form> 
    </div><!-- /content --> 
    <div data-role="footer" data-theme="b"> 
     <h4>TEST</h4> 
    </div><!-- /footer --> 
</div><!-- /page --> 

編輯 我注意到,當照片選擇後顯示launcherPage,如果我點擊我的手機的背面按鈕,它正確顯示圖片頁面與包括所選擇的圖像...

編輯2 當我從HTML代碼註釋的launcherPage,畫面選擇之後,它顯示登錄頁面...

回答

0

我想出的解決方案,這個問題不是從CSS正在添加,但HTML:

我只是改變了這種代碼:

<button onclick="capturePhoto();">Capture Photo</button> 

這樣:

<a href="" class="ui-btn" onclick="capturePhoto();">Capture Photo</a> 

別t使用html按鈕標記,使用錨標記...不知道爲什麼,但這工作!

希望這會幫助別人