2011-10-27 16 views
6
$(document).bind 'touchstart', (event) -> 
    console.log event.touches 

這始終是不確定的,我想不通爲什麼。至於targetTouches是,event.touches是始終不確定

任何想法?我正在iPad上測試。

謝謝。

回答

28

你的語法看起來怪我,但在常規的JavaScript:

$(document).bind('touchstart', function(event) { 
    console.log(event.originalEvent.touches); 
}); 
+0

對不起,它在CoffeeScript的。感謝你的回答! – fancy

+5

+1 - 花了我一段時間才意識到,jquery沒有使用原始事件 –

+2

謝謝你原來的事件增加 - 它的作品像魔術:) – nurxyz