I am trying to rotate an element (like a dial) by clicking and dragging. I have the basic concept down but its sligtly glitchy.
See my current example here: https://jsfiddle.net/o5jjosvu/
When clicking and dragging inside the element, it judders. But when the cursor is outside the element its a smooth transformation.
I think the issue is due to the way I'm handling the events but I'm not sure.
$('.element').on('mousedown', function() {
$(document).bind('mousemove', function() {
// Calculate rotation
});
});
$(document).on('mouseup', function() {
$(document).unbind('mousemove');
});
Any help would great, thanks.