N
N
Nora2021-07-08 16:40:28
JavaScript
Nora, 2021-07-08 16:40:28

How to remove the distance between the cursor and the image when clicked?

60e6fffe9bc45572866957.png

let banknonte = banknotes[i];
        banknonte.onmousedown = function(event){
          banknonte.style.position = "absolute";
          banknonte.style.transform = "rotate(90deg)";
          banknonte.ondragstart = function(){return false;}
          banknonte.style.top = event.clientY-banknonte.height/2+"px";
          banknonte.style.left= event.clientX-banknonte.width/2+"px";
          document.onmousemove = function(e){
            banknonte.style.top = e.clientY-banknonte.height/2+"px";
            banknonte.style.left= e.clientX-banknonte.width/2+"px";
          }


Link if that noradrzo.beget.tech/coffee_machine2.html

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FKV, 2021-07-08
@noradrenaline

For the #display element, remove position: relative;
Well, read about positioning https://developer.mozilla.org/en/docs/Learn/CSS/CS...

S
Stalker_RED, 2021-07-08
@Stalker_RED

I'll just leave it here: https://developer.mozilla.org/en/docs/Web/API/HTML...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question