I'm experimenting on a drag 'n' drop, this is my code here:
$('.box-title').live('mousedown click', function(e)
{
var self = $(this);
var Box = self.parent('#box');
if(e.type == 'mousedown')
{
$(window).mousemove(function(e)
{
Box.css({ cursor: 'move', top: e.pageY - 15, left: e.pageX - 125 });
});
}
else if(e.type == 'click')
{
Box.css({ cursor: 'default', top: e.pageY - 15, left: e.pageX - 125 });
}
});
On mousedown, it should initiate the dragging effect by moving the mouse, after that if I want to dock/drop the box where I want it to me, I click on it it should disable the moving but if I click on it, it doesn't stop moving - just keeps following my mouse. How can you stop the dragging?