Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQueryUI Draggable Helper Option Help

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.

like image 581
ryanzec Avatar asked Aug 05 '10 15:08

ryanzec


People also ask

Why draggable is not working?

Check whether your draggable object is already loaded in the viewport. If it is not, it won't work properly. JUST AFTER the draggable object to be absolutely sure that everything is loaded at the correct time. When you'll be sure everything is ok, then you'll be able to refactor.

How do I limit a draggable area?

Limit draggable area using 'containment' option The containment option has a value parent. Now, the draggable area of the child <div> element (<div id='intro'>) is restricted or limited to the element's parent area (width and height), which is another <div> element (<div id='mainContainer'>).

What is the syntax of the draggable function?

Syntax: $(selector, context). draggable ("action", [params]);

How do you make a draggable element?

To make an object draggable set draggable=true on that element. Just about anything can be drag-enabled: images, files, links, files, or any markup on your page.


1 Answers

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

like image 152
Ken Redler Avatar answered Oct 01 '22 13:10

Ken Redler