jquery custom drag and drop
Posted
by samlochner
on Stack Overflow
See other posts from Stack Overflow
or by samlochner
Published on 2010-05-09T18:34:08Z
Indexed on
2010/05/09
18:38 UTC
Read the original article
Hit count: 215
I am trying to create functionality similar to drag and drop. I need to create my own as there will be some significant differences to the drag and drop in the jquery UI.
I would like to have mousemove being called repeatedly at all times, and mousedown called every time the mouse is pressed. So I have the following code:
$(document).bind('mousemove',function(e){
$("#coords").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY);
});
$(document).bind('mousedown',function(e){
});
('coords' is the id of a div)
As I move the mouse, coordinates are reported correctly in 'coords'. If I depress a mouse button and then move the mouse, coordinates are still reported correctly. But if I depress a mouse button on an image and then move the mouse, coordinates are reported correctly for a few sets, and then they seize up! Why is this happening and how can I fix it?
Thanks, Sam
© Stack Overflow or respective owner