creating custom drag and drop

creating custom drag and drop

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 that provided in the UI.

I would like to have mouse move 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){ 
});

As I move the mouse, coordinates are reported correctly. 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