问题
What I have:
Draggable divs that have an alert on start and revert when dropped.
What I need:
When user tries to drag the div, an alert pops up saying you can't drag it and the dragging stops before it even goes anywhere.
回答1:
You can return false
within the start() method to accomplish this:
$("#draggable").draggable({
start: function(event, ui) {
alert('Dragging is disabled');
return false;
}
});
JSFiddle: http://jsfiddle.net/Jam8Z/
来源:https://stackoverflow.com/questions/20913338/cancel-draggable-div-on-start