开发者

How can I provide user feedback when a draggable is rejected by a droppable?

jQuery 1.3 jQuery UI 1.7.2

I have an application where there are a number of droppable divs that accept only a single draggable. I do this by setting the accept option on all my droppable's to a function that check for a valid dragg开发者_如何学JAVAable and if it is already occupied. If it is occupied, the accept function returns false, else it returns true. Thus if a user tries to drop a draggable on a droppable that is already occupied, the draggable reverts.

What I would like to do is provide additional feedback when a user drops a draggable on top of an occupied droppable. Any idea how I can do this?


Why not do this with a class? Set the parent item with the class 'full' when you drop the dragged element. Then you could do something like:

if($this).hasClass('full'))
    //Alert user it is full
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜