【问题标题】:Very slow reaction of clicking the panel or no reaction at all - Phonegap 2.9 + JQuery单击面板的反应非常慢或根本没有反应 - Phonegap 2.9 + JQuery
【发布时间】:2014-10-02 16:51:37
【问题描述】:

我正在 Eclipse 中使用 PhoneGap 2.9 for Android 开发一个移动应用程序。 我已经阅读了许多其他关于面板的 StackOverflow 问题,例如this one。

因为我的应用程序需要 wi-fi 才能让别人使用它,所以我没有下载 JQuery,但我从我的 .html 文件中调用它们:

    <!-- import js --> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script>
    <script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

在上面的链接中,一个答案说要编辑 JQuery 的 .css,所以我不能这样做。


正如我在另一篇与此问题相关的帖子中所读到的,我创建了一个 JavaScript,我在导入 JQuery 后立即调用它。内容:

document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        $.mobile.defaultPageTransition   = 'none';
        $.mobile.defaultDialogTransition = 'none';
        $.mobile.buttonMarkup.hoverDelay = 0;
    }

我的.html与面板相关的代码是这样的:

        <div id="leftHead"> 
            <a href="#menu"><img src="../../imgs/menu.png"></a>
        </div>

  <!-- defaultpanel  -->
  <div data-role="panel" id="menu" data-theme="b" data-display="push" data-animate:"false">

    <div class="panel-content">
        <h3>Default panel options</h3>
        <a href="">Option One</a><br/>
        <a href="">Option Two</a><br/>
        <a href="home.html" data-rel="close" data-role="button" data-theme="a" data-icon="delete" data-inline="true">Close panel</a>
    </div><!-- /content wrapper for padding -->
  </div><!-- /defaultpanel -->

当我按下lefthead div 中的图像时,有时我得到一个非常缓慢的响应,有时单击后没有面板打开。谁能帮助我,让我可以更快地完成这个简单的功能?

【问题讨论】:

    标签: javascript jquery cordova panel


    【解决方案1】:

    您是否使用 Fastclick 库对其进行了测试?

    https://github.com/ftlabs/fastclick

    【讨论】:

    • 谢谢你现在真的很快。
    猜你喜欢
    • 1970-01-01
    • 2015-01-21
    • 2012-08-06
    • 1970-01-01
    • 2017-12-18
    • 1970-01-01
    • 1970-01-01
    • 2012-08-26
    • 1970-01-01
    相关资源
    最近更新 更多