首页 > 代码库 > touchmove 实时获取当前元素

touchmove 实时获取当前元素

var ele = document.elementFromPoint(touch.pageX, touch.pageY);   //根据坐标直接返回元素document.elementFromPoint()

 

eg:


    $("ul li").on("touchmove touchstart", function(e) {
     event.preventDefault();
     e = e || window.event;
     var touch = e.originalEvent.targetTouches[0];
     var ele = document.elementFromPoint(touch.pageX, touch.pageY);
    });

touchmove 实时获取当前元素