I do not believe that there is a way to request the position of the mouse, but you can use the mousemove handler, which simply stores the information, so you can request the stored information.
jQuery(function($) { var currentMousePos = { x: -1, y: -1 }; $(document).mousemove(function(event) { currentMousePos.x = event.pageX; currentMousePos.y = event.pageY; });
But almost all code, except setTimeout code, etc., is run in response to an event, and most events provide mouse position. So your code, which should know where the mouse probably already has access to this information ...
TJ Crowder Dec 23 2018-10-12T00: 00Z
source share