JQuery obtains the X and Y coordinates of the mouse in a rectangular container

From , 5 Years ago, written in JavaScript, viewed 217 times.
URL https://pastebin.vip/view/fb3a30a2
  1. $(function() {
  2. $("#demo-box").click(function(e) {
  3.  
  4.   var offset = $(this).offset();
  5.   var relativeX = (e.pageX - offset.left);
  6.   var relativeY = (e.pageY - offset.top);
  7.  
  8.   alert("X: " + relativeX + "  Y: " + relativeY);
  9.  
  10. });
  11. });
  12. //javascript/4266

Reply to "JQuery obtains the X and Y coordinates of the mouse in a rectangular container"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website