【发布时间】:2010-09-16 05:26:38
【问题描述】:
我正在创建一个自定义拖动助手(在 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;
}
}
但我根本无法使用原始功能。 return clone() 工作正常,但 return $(this) 没有任何乐趣。
【问题讨论】:
标签: javascript jquery