2
我创建一个自定义的拖帮手(jQuery中):如何重新实现jQuery的缺省助手在自定义帮助
$('.dragme', element).draggable({
appendTo: 'body',
helper : custom_drag_helper,
opacity : 0.5
});
我这样做是因为我想有时克隆,有时做的默认功能,即拖动原始元素。
function custom_drag_helper() {
if (/*criteria on when to move instead of clone */) {
return $(this); /* this is what helper: 'original' seems to do */
} else {
clone = $(this).clone(); /* this is what helper: 'clone' does */
return clone;
}
}
但是我无法获得原始的功能。返回克隆()工作正常,但返回$(这)没有喜悦。