0

我有一个带有 ID 的图像网格。当用户在移动触摸设备上捏捏时,我想检测用户捏捏的是哪个实例。因此,我不想为每个尝试检测夹点的 ID 创建 30 个锤子实例,而是想以相反的方式检测它。我希望我的问题很清楚。

干杯!

4

1 回答 1

2

您可以使用event-object 来确定当前target

$(document).on('touchstart', function(e){
    $(e.target) // this is your element
});

或者,如果您需要在 上测试它touchmove,请使用elementFromPoint和手指坐标:

$(document).on('touchmove', function(e){
    $( document.elementFromPoint(e.touches[0].pageX, e.touches[0].pageY) ) // this is your element
});

更新

您可以使用$.event.props.push("touches");规范化touches.

于 2013-02-12T17:48:47.210 回答