Answers for "jquery get mouse page left and top"

0

jquery get mouse page left and top

$("#something").click(function(e){
   var parentOffset = $(this).parent().offset(); 
   //or $(this).offset(); if you really just want the current element's offset
   var relX = e.pageX - parentOffset.left;
   var relY = e.pageY - parentOffset.top;
});


/-FOLLOW ME ON INSTA-/
@hardcode_studios
Posted by: Guest on April-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language