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.
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.
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'>).
Syntax: $(selector, context). draggable ("action", [params]);
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With