Cancel draggable div on start [closed]

ⅰ亾dé卋堺 提交于 2019-12-13 04:33:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!