Using jQuery:
var divPos = {};
var offset = $("#divid").offset();
$(document).mousemove(function(e){
divPos = {
left: e.pageX - offset.left,
top: e.pageY - offset.top
};
});
More Related Contents:
- Get pixel color from canvas, on mousemove
- I want to do animation of an object along a particular path
- jQuery equivalent of getting the context of a Canvas
- HTML5 responsive canvas: resizing the browser canvas draw disappear
- Javascript function to Rotate a base 64 image by X degrees and return new base64
- Cancel single image request in html5 browsers
- JavaScript runtime error: ‘$’ is undefined
- canvas- Cropping images in different shapes
- Cropping with drawImage not working in Safari
- “Thinking in AngularJS” if I have a jQuery background? [closed]
- Managing jQuery plugin dependency in webpack
- Changing the image source using jQuery
- Prevent double submission of forms in jQuery
- how to bypass Access-Control-Allow-Origin?
- Get index of element as child relative to parent
- Mismatched anonymous define() module
- How do I do string replace in JavaScript to convert ‘9.61’ to ‘9:61’?
- How to dynamically create ‘@-Keyframe’ CSS animations?
- How to detect if the user clicked the “back” button
- How to mute an html5 video player using jQuery
- Better way to prevent browser caching of JavaScript files
- $this vs $(this) in jQuery
- How do I find out how many times a function is called with javascript/jquery?
- Why web browsers don’t have jQuery built in? [duplicate]
- Create array of all integers between two numbers, inclusive, in Javascript/jQuery
- Kendo UI Grid multi level hierarchy (n-levels of hierarchy)
- Can we use the value of localStorage from other domains?
- how to upload and delete files from dropzone.js
- How do you make images load lazily only when they are in the viewport?
- What is the new proper way to use a child selector with a context node in jQuery?