开发者

Combining revert with jQuery draggable/droppable

开发者 https://www.devze.com 2023-02-13 21:54 出处:网络
I\'m using the drag and drop plugin with jQuery UI. I\'d like to make it so that the drag开发者_Python百科gable container can only be dragged and dropped on the container. In the demonstration:

I'm using the drag and drop plugin with jQuery UI. I'd like to make it so that the drag开发者_Python百科gable container can only be dragged and dropped on the container. In the demonstration:

http://jqueryui.com/demos/droppable/#revert

It has 2 options. One is to revert when it drags to the container, the second is to revert when it isn't dragged to the container.

Is there a way to combine these two? I don't want to be able to drag the #draggable container anywhere where there isn't a #droppable container.


As stated above, I found the solution by adding :

$('#draggable2').remove(); 
$('#draggable').draggable({ revert: true });
0

精彩评论

暂无评论...
验证码 换一张
取 消