Answers for "how to move an element to the cursor in javascript"

0

how to move an element to the cursor in javascript

$(document).ready(function() {
  $(this).on("click", function(e) {
    var x = e.pageX;
    var y = e.pageY;
    var el = $("#meh");
    el.css('position', 'absolute');
    el.css("left", x);
    el.css("top", y);
  })
})
Posted by: Guest on January-07-2021

Code answers related to "how to move an element to the cursor in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language