angular-sortable-view icon indicating copy to clipboard operation
angular-sortable-view copied to clipboard

What is the syntax for containment?

Open tonejac opened this issue 9 years ago • 2 comments
trafficstars

I couldn't easily see any code examples of the attribute to add for constraining the sv-elements to the bounds of the sv-root.

Please provide example.

Thank you for the great work. :)

tonejac avatar Jul 23 '16 01:07 tonejac

I got containment to work by looking in the source code and trying out some different stuff. In the end i got it to work by using example below, but it creates some latency when moving because of the constant checking for bounderies.

HTML

<div sv-root sv-part="editItem.Gallery">
     <div sv-element="opts" class="editImage grid" ng-repeat="picture in editItem.Gallery">

CONTROLLER

// Set containment div - but this creates some latency when moving
var containmentElement = angular.element('#your_div_containment')[0];
$scope.opts = {
   "containment": containmentElement
};

bgpedersen avatar Nov 14 '16 11:11 bgpedersen

Use sv-element="{containment:'.your-parent-div-class'}" in the childen. I used and it worked Reference and credits -> https://github.com/kamilkp/angular-sortable-view/issues/89#issuecomment-228787116

modernwarfareuplink avatar Jun 28 '20 11:06 modernwarfareuplink