html - Apply Containment to Clone JQuery -
i want apply containment clone of image when dragged 1 div (keeping clone draggable).
the problem when image dragged , dropped div clone becomes un-draggable, inorder make draggable have called .draggable function calling loses containment attribute , become draggable everywhere. have tried best find solution can't find anything.
$(function() { $(".move-icon-class").draggable( { containment: '#screen', helper:'clone', revert: 'invalid', scroll: false, collision: 'fit flip', } ); $("#screen").droppable({ accept: '.move-icon-class', activeclass: 'ui-state-hover', hoverclass: 'ui-state-active', drop: function(event, ui) { dropped = true; $.ui.ddmanager.current.cancelhelperremoval = true; ui.helper.appendto(this).draggable(); // want apply containment } }); });
when assign draggable within drop, want set containment option @ time.
ui.helper.appendto(this).draggable({ containment: '#screen' }); this set containment again.
Comments
Post a Comment