Boom, check this out: Fiddle.
Here's the javascript:
var posX, posY, clicked = false;
function mueve (e) {
clicked = true;
posX = e.pageX - 20;
posY = e.pageY - 20;
$('.item').animate({left: posX, top: posY});
}
$(document).on('mousedown', mueve);
$(document).on('mouseup', function(e) {
clicked = false;
});
$(document).mousemove(function(e) {
if (clicked) {
$('.item').stop(true, true);
mueve(e);
}
});
What I did was: when you click down, you change the variable clicked
to true, so when you move the mouse it will move the div with class 'item'. Also, you have to clear each queued animation before updating positions.