I have some pure css snap scroll functionality and I want to detect where an element is relative to the viewport after the user stop dragging. The thing is I don't wan't to use some fancy library because I don't need to actually move or drop something. I just wan't to fire an event on mouseup. My problem is that the mouseup event won't fire after I moved my cursor while having the left mouse button pressed. Btw. I'm using Vu3
<span id="handle" class="card-handle" onmouseup="myMethod"></span>
I hope to find a lightweight solution, scince I don't really need all this dragging functionality
As far as I know you can try something like
<span id="handle" class="card-handle" ondragend="myFunction(event)" draggable="true"></span>
and in your methods
methods: {
myFunction() {
var x = e.clientX;
var y = e.clientY;
var coor = "Coordinates: (" + x + "," + y + ")";
console.log(cor);
}
}