JSFiddle - React, Tailwind, and code Playground

by WilsonPage

HTML

<div draggable='true'></div>

CSS

div{
    width:100px;
    height:100px;
    position:absolute;
    left:0px;
    top:0px;
    background:#444;
  cursor: move;
}

JavaScript

function onDragStart(e) {
    //this.style.opacity = '0.4';  // this / e.target is the source node.
    $(this).hide();
    $(this).on('mousemove', onMouseMove);
      console.log(e);
}

function onMouseMove(e) {

    console.log(e.clientX);
  
}

function onMouseDown(e) {

    $(this).on('mousemove', onMouseMove);
  
}

var div = $('div');

div.on('mousedown', onMouseDown);
//div.on('dragenter', handleDragEnter);
//div.on('dragover', handleDragOver);
//div.on('dragleave', handleDragLeave);