.originalEvent , .targetTouches[0] , .touches[0] , .changedTouches[0];分別是什么意思?
最近在寫一個移動端的觸摸事件,發現獲取觸摸點的屬性就必須用到??? .originalEvent ?? ,?? .targetTouches[0]?? , ?? .touches[0] ,?????? ????.changedTouches[0] 這些函數,查了很久也找不到關于這些函數的具體介紹,請問這些是干什么的,有什么作用,括號里的參數0,有什么意義?
2015-04-02
括號里的參數0:例如targetTouches[0] 這個表示當前位于 屏幕上的手指列表 取第一個
2017-04-21
對于originalEvent,個別答案有誤導嫌疑,明明是jQuery封裝的,大家可以自己測測
$('#aaa').on("touchstart", touchStart);
? ? function touchStart(event){
? ? ? ? console.log(event);
}
這樣可讀到,event.originalEvent.touches[0]
//////////////////////////////////////////////////
用原生的,這樣可讀到,event.touches[0]
document.getElementById('aaa').addEventListener("touchstart", touchStart, false);
? ? function touchStart(event){
? ? ? ? console.log(event.touches[0]);
}
2016-08-25
過一年了,樓主會了么?
event.originalEvent.changedTouches[0].clientX和event.touches[0].clientX有什么區別啊,
2015-04-02
效果倒是能實現了,但是卻搞不懂為什么必須加上這兩段才能獲取touch的相對位置。。