0
我正在研究一個應用程序,其中有5個圖像,我想在touchstart事件開始時獲取圖像的標識,因爲我想將這些圖像移動到某個位置。我正在使用JavaScript。從touchstart事件獲取圖像ID javascript
我正在研究一個應用程序,其中有5個圖像,我想在touchstart事件開始時獲取圖像的標識,因爲我想將這些圖像移動到某個位置。我正在使用JavaScript。從touchstart事件獲取圖像ID javascript
如果你使用jQuery,並且前提是你必須touchstart事件勢必圖像
$('img').bind('touchstart', function() {
var imageId = this.id;
});
您是否嘗試過'event.target'? – Blender 2013-02-25 09:01:04
是的event.target.id它適用於我。 – 2013-02-25 10:00:10