如何在 touchmove 期间获取手指下元素的 id?
我想要实现的是:
- 绑定触摸[开始|结束|移动]
- 在 touchstart 开始选择
- 在 touchmove 期间,收集我手指下“触摸”的所有 dom 元素
示例代码
var collected = [];
$('body').bind('touchstart touchmove touchend', function(event) {
event.preventDefault();
if(event.type == 'touchstart') {
collected = [];
} else if(event.type == 'touchmove') {
// id of the element under my finger??
// insert in collected the id of the element
} else if(event.type == 'touchend') {
// some code
}
});
解决了。