2
混淆最佳方法來測量在touchend
事件期間元素是否超過另一元素(可視化)。基本上,我正在實施一種觸控友好的拖放操作。javascript touchend如果元素超過另一個
我在.elementFromPoint()
和event.touches
上看過一點點,但我不確定如何使用這些來衡量特定元素的邊界。像下面的東西。
.bind('touchend', function(e){
e.preventDefault();
/* IF (targ is within titles bounds) { append targ to titles} */
if (titles == document.elementFromPoint(orig.touches[0].pageX,orig.touches[0].pageY)){
titles.append(targ);
}
targ.removeClass('moving').removeAttr('style');
});