Can anyone tell me how I can write a function in accept condition and then how does it finds out that what to accept and what not to accept.
For example, I want to accept div a
and div b
in accept condition. How can I write I through a function?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
This is the solution that I use:
In addition to Alex answer which is the best answer I found on this question, I like to add, that if you want to check for matching attributes between
droppable
anddraggable
, you can use the keywordthis
to access the droppable within youraccept
function. Here is a small example I recently used:So the
draggable
is only accepted, when it'sid_group
(remember, just an example) matches with theid_group
of thedroppable
, otherwise thedraggable
would be reverted. I think this could be a very common use-case, maybe this will help someone.