jquery droppable accept

后端 未结 8 2155
轻奢々
轻奢々 2020-12-13 07:02

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

8条回答
  •  一生所求
    2020-12-13 07:24

    According to the Jquery documentation on Selectors.

    All draggables that match the selector will be accepted. If a function is specified, the function will be called for each draggable on the page (passed as the first argument to the function), to provide a custom filter. The function should return true if the draggable should be accepted.

    Thus,

    $('.selector').droppable({ accept: '.special' }); 
    

    in their example will only act as if something has been dropped on it if it has the class 'special'. It looks like it can accept any Jquery selector.

提交回复
热议问题