【问题标题】:Events Fire Twice in jQueryMobile Application事件在 jQueryMobile 应用程序中触发两次
【发布时间】:2013-05-14 07:01:18
【问题描述】:

PhonegapjQM 应用程序有问题。在这种情况下,一个事件会在 Android 设备上触发两次。

为了消除闪烁效果,我将页面转换设置为 'none'。 当我单击菜单按钮时,它会导航到第 2 页。此外,该页面上同时触发了另一个事件。

解决办法是什么?

【问题讨论】:

  • 如果您可以向我们提供您的代码,我们将无能为力。您的问题可能发生在几个不同的场合。

标签: javascript android jquery cordova jquery-mobile


【解决方案1】:

将下面的代码 sn-p 粘贴到您网页的 head 部分的样式标签中。这可能会有所帮助。

.ui-page {
    -webkit-backface-visibility: hidden;
} 

【讨论】:

  • 上面的css代码是为了避免闪烁效果,不是为了避免两次触发事件
【解决方案2】:

要解决两次触发事件,请将 pageinit 函数代码放在 html 页面的 head 部分中

<head>
<script type="text/javascript">
..your pageinit function code
</script>
</head>

(或)

使用 jquery on() 代替 jQuery live() 方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-11
    • 2012-07-12
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    相关资源
    最近更新 更多