开发者

Disable a sortable?

I have a draggable connected to a sortable:

$("#panelTarget").sortable({
    distance: '15'
});

var element = $('<li>Hello</li>');
element.appendTo('#panelSource');
element.draggable();
element.draggable("option", "connectToSortable", '#panelTarget');

at some point, I want to make it impos开发者_开发技巧sible for the user to drop items onto the sortable panel (panelTarget). I'm trying this:

$('#panelTarget').sortable( "disable" );

but I can still drop elements onto it, am I not interpreting the docs correctly?:

http://jqueryui.com/demos/sortable/#method-disable

how can I block the user from dropping stuff on the panel?

Thanks


This event/action comes from the .draggable() side, so you need to disable it there, like this:

element.draggable("option", "connectToSortable", false);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜