JSFiddle - React, Tailwind, and code Playground

by msfrisbie

HTML

<div id="target" style="width: 200px; height: 200px; background-color: red;"></div>
    <div id="log"></div>

JavaScript

function logIt(e) {
    //console.log(e)
    e.preventDefault();
    
    try {
        $('#log').prepend('<div>'+e.originalEvent.touches[0].clientX+', '+e.originalEvent.touches[0].clientY+'</div>')
    } catch (e) {
         alert(e)   
    }
    
}

$('#target').on('touchmove', function(event) {
    logIt(event)
})
//$('#target').on('mousemove', function(event) {
//    logIt(event)  
//})
//$('#target').on('vmousemove', function(event) {
//    logIt(event)
//})