簡體   English   中英

在Android應用程序中本地包含Jquery mobile

[英]Including Jquery mobile locally in android app

將jQuery mobile css和js文件本地存儲在android項目的Assets文件夾中時,無法在android App中呈現jQuery mobile樣式。 但是,通過包含CDN中的jquery移動文件也可以實現這一點。 幫我

    <!DOCTYPE html>
 <html>
  <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SAMPLE</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="file:///android_asset/www/css/jquery.mobile-1.3.2.min.css" /> 
    <script type="text/javascript" charset="utf-8" src="file:///android_asset/www/js/cordova-2.7.0.js"></script>
    <script src="file:///android_asset/www/js/jquery.mobile-1.3.2.min.js"></script> 

  <!-- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> 
 <script src="js/TamkeenJQ.js"></script>
   -->

  </head>
  <body>
   <div data-role="page" id="page1"> 
    <div data-role="header" data-position="fixed">
     Header
    </div>
    <div data-role="content">
    content
    <button onclick="changePageFn()">Change Page</button>
    </div>
    <div data-role="footer" data-position="fixed">
     Footer
    </div>
   </div> 

   <div data-role="page" id="page2"> 
    <div data-role="header" data-position="fixed">
     Header
    </div>
    <div data-role="content">
    content
    </div>
    <div data-role="footer" data-position="fixed">
     Footer
    </div>
   </div>

  </body>

 </html>

實際上,它在您的實現中看起來有些問題。

如果您已包含與jquery mobile相關的js和css文件的正確路徑。

解決方案:重新整理js和css文件的路徑。

在head標簽中使用以下順序

 <link rel="stylesheet" href="css/jquerymobile-1.3.2.min.css" /> 
    <script type="text/javascript" charset="utf-8" src="js/cordova-2.7.0.js"></script>
    <script src="js/jquery-1.9.1.js"></script> 
    <script src="js/jquerymobile-1.3.2min.js"></script>
  1. 首先添加jquery css文件。
  2. 然后添加jquery 1.9.1 js文件。
  3. 然后添加jquery mobile 1.3.2 js文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM