.mouseAbs() - Absolute position of mouse pointer
Gets the absolute position of mouse with respect to document and event will be triggered when hovers an element. mouseAbs() will be mostly used within the listener function of mouse events.
Returns
Example 1
Find the absolute and relative position of mouse pointer over a div box. Move the cursor pointer over the div.
JS
HTML
CSS
$.domLoaded(function() { $.get("#box1").on("mousemove", function() { // Get the absolute mouse position relative to document var po = $.self().mouseAbs(); $.get("#msg1").html("Absolute - Mouse is at x : " + po.x + " y : " + po.y); // Get the relative mouse position var po = $.self().mouse(); $.get("#msg2").html("Relative - Mouse is at x : " + po.x + " y : " + po.y); }); });
Result
| |||||