angular-sortable-view
angular-sortable-view copied to clipboard
What is the syntax for containment?
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. :)
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
};
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