【问题标题】:Setting up Jquery Mobile for Phone Gap为电话间隙设置 Jquery Mobile
【发布时间】:2014-01-14 11:19:53
【问题描述】:

我希望设置带有电话间隙的 jquery mobile 并执行一个非常简单的任务来查看它是否正常工作。这是我目前所拥有的:

    <!DOCTYPE html>
<html>
  <head>
    <title>Device Properties Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/jquery.mobile.custom.js"></script>
    <script type="text/javascript" charset="utf-8">
        $(document).on('pageinit', function(){
            $("#geolocation").html("Hey World");
        });
    </script>
  </head>
  <body>
    <p id="geolocation">Finding geolocation...</p>
  </body>
</html>

我想将 p 标签的内容更改为“Hey World”。我对Phone Gap很陌生。任何建议都会很棒。

【问题讨论】:

  • 你也加载了 jQuery 吗?

标签: jquery-mobile cordova


【解决方案1】:

您的头部缺少许多参考资料:

  1. jQuery Mobile CSS 文件
  2. jQuery JS 文件

您还需要检查 PhoneGap 的 deviceready 事件,除非您在之前由 PhoneGap 加载的页面上完成了该操作。例如:

$(document).on("deviceready", function()
{
    // phonegap ready
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-16
    • 1970-01-01
    • 2013-03-31
    • 2015-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多