Created
April 22, 2019 14:32
-
-
Save akhileshdarjee/f243d6477f3c6ab68d71332ed8aad4d3 to your computer and use it in GitHub Desktop.
Always keep cursor horizontally and vertically center of the dragging object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').find('.draggable').draggable({ | |
stack: ".draggable", | |
helper: 'clone', | |
start: function(event, ui) { | |
$(this).draggable('instance').offset.click = { | |
left: Math.floor(ui.helper.width() / 2), | |
top: Math.floor(ui.helper.height() / 2) | |
}; | |
ui.helper.css('cursor', 'move'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment