Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the syntax for containment? #99

Open
tonejac opened this issue Jul 23, 2016 · 2 comments
Open

What is the syntax for containment? #99

tonejac opened this issue Jul 23, 2016 · 2 comments

Comments

@tonejac
Copy link

tonejac commented Jul 23, 2016

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. :)

@bgpedersen
Copy link

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
};

@modernwarfareuplink
Copy link

modernwarfareuplink commented Jun 28, 2020

Use sv-element="{containment:'.your-parent-div-class'}" in the childen. I used and it worked
Reference and credits -> #89 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants