How to get the mouse position when the mouse is not moving (no mousemove)
js jq will do anything
What everyone said makes sense, and I am very happy to study this problem with you~ Waiting for the master~ Or maybe there is really no way at this stage~
If you are not moving after mousemove, just use a variable to save the coordinates of the last move, and read the value of this variable in the future.
If you want to get the coordinates of the mouse when the page is first loaded, I just tried a few events and it doesn’t seem to work. Wait for the master to help you
It seems that if there is no mouse event, the position cannot be obtained. Is onclick event OK? If it doesn't work, just pretend I didn't say it.
document.onclick = getMousePos;
function getMousePos(event) {
}
Acquiring the mouse and keyboard belongs to the event class. The event is that event. If you do not generate an event, you cannot obtain the mouse position
Sit back and wait for the master. After trying F5, I still can’t get the coordinates
If there is no trigger event, there is almost no way to obtain the coordinates.
A not-so-nice note:
Let me assume one thing first:
Save the last triggered position when it has been triggered.
It’s not too far away compared to when your mouse doesn’t move at all.
If you need more accuracy, you may need to analyze the path.
But they are all based on one assumption:
mousemove
has been triggered and observable data has been generated. Before that, it was all undefined.Continue to pay attention and wait for the master