jquery droppable接受 [英] jquery droppable accept
本文介绍了jquery droppable接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以告诉我如何在接受条件下编写函数,然后如何找出接受什么和不接受什么。
例如,我想在接受条件下接受 div a
和 div b
。如何通过函数编写I?
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?
推荐答案
如果您希望droppable接受一系列元素,您可以执行类似的操作这个:
If you want the droppable to accept a selection of elements you can do something like this:
$(".droppable").droppable({
accept: function(d) {
if(d.hasClass("foo")||(d.attr("id")=="bar")){
return true;
}
}
});
此droppable将接受具有类foo的元素或具有idbar<的元素
This droppable will accept elements with the class "foo" or an element with the id "bar"
这篇关于jquery droppable接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文