jQueryUI Draggable Helper Option Help

2019-06-22 15:04发布

问题:

Is it possible to modify the clone helper that jQueryUI creates with draggable element? I don't want the exact clone as the helper, I just want something similar to it.

回答1:

For the helper option, instead of clone, use a function that returns a DOM object. Make this object "similar" any way you like. Something like this:

$('.selector').draggable({ 
    helper: function(){
        var foo = dom_object_you_create_or_specify;
        return foo;
    }
});

References: jQuery UI Draggable