0

everyone. I want to disable user ability to drag with JavaScript. It's a moment when a mouse turning to this if u hold your primary mouse pressed long enough and u see that ghost image of an element.

I have grid 10x10 elements something like this and event listener for parent container.

let parent = document.getElementsByClassName("bottomPart")[0];
parent.addEventListener("mousemove", moveFunction);

After dragging mouse elements should change his color

function moveFunction(target){
    if(target.buttons == 1){
    let bulb = document.getElementById(target.toElement.id);
        if(bulb!=null){
            bulb.style.background = `rgb(${color.r},${color.g},${color.b})`;
        }
    }
}

For the first time it's all good. But then the issue occurs the mouse on drag turns into this. And i can't change color anymore.

Dev Codev
  • 1
  • 1

0 Answers0