简体   繁体   English

jQuery Mobile无法响应或不触发HTML5 iPhone应用程序上的水龙头(Safari)

[英]jQuery Mobile not responding to, or not triggering, taps on HTML5 iPhone app (Safari)

We're using jQuery Mobile to handle gestures and touch events for a iPhone HTML5 web app. 我们正在使用jQuery Mobile处理iPhone HTML5 Web应用程序的手势和触摸事件。 Unfortunately, it doesn't seem to work after a few taps. 不幸的是,几次轻按后它似乎不起作用。 We're using JQM 1.3.2, the latest stable, along with jQuery 1.10.1. 我们使用的是最新的JQM 1.3.2,以及jQuery 1.10.1。

To reproduce: 复制:

1) Visit www.tekiki.com on an iPhone or www.tekiki.com/dandy/dandy from a desktop. 1)在iPhone上访问www.tekiki.com或从台式机访问www.tekiki.com/dandy/dandy

2) Swipe left to show the category menu. 2)向左滑动以显示类别菜单。

3) Tap on the Games category (not All Games ). 3)点击“ 游戏”类别(不是“ 所有游戏” )。

4) After the games render, tap on the Finance category. 4)游戏渲染后,点击“ 财务”类别。

At this point, taps on other categories are ignored. 在这一点上,其他类别的水龙头将被忽略。 It doesn't seem like JQM is triggering the tap event since breakpoints in the relevant code below aren't getting hit. 似乎JQM不会触发tap事件,因为下面相关代码中的断点没有命中。

Code snippet: 程式码片段:

// Bind what happens when user taps on category
$( '#templates .category_box' ).on( 'tap', function( ev ) {     
    // Prevent double taps
    ev.preventDefault();

    // Set category picked history
    CHOSEN_CATEGORY_ID = $(this).attr('itunes_id');

    // Show page
    p_change_page( '#category_page' );
});

Elements should be present in DOM when binding events to them. 将事件绑定到元素时,元素应出现在DOM中。 Even copied / cloned elements are considered dynamic, and the way of binding events to them 甚至复制/克隆的元素也被认为是动态的,并且将事件绑定到它们的方式

$(document).on('event', '.dynamic', function () {
 // code
});

Or this way 或者这样

$('.static_parent').on('event', '.dynamic', function () {
 // code
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM