开发者

jquery draggable accept: classpath

I have problems with the following bit of javascript/jquery c开发者_运维技巧ode:

this.droppable = function(){
    $('.imageWindow .body .item').draggable();
    $('.groupWindow .body .item').droppable({ accept: $(".imageWindow .body .item"), 
        over: function(event, ui) {
            alert("this is valid!");
        }, 
        drop: function(){
            alert('dropped');
        }
    });
}

As you maybe know it is not possible to pass the following in the accept option:

$(".imageWindow .body .item")

But what is possible ? I want to pass a "class path" as an accept option ! It is probably a simple answer but i can't figure it out.

Of course i could do:

accept: ".item"

But because "groupWindow .body .item" is a sortable it would also accept himself!

Thanxs if you can help me!


You can do this :)

accept: ".imageWindow .body .item"

The accept option takes any valid selector, so treat it the same as you would $(selectorHere).


You should be able to do:

accept: ".imageWindow .body .item"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜