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

Feature: return custom containment #197

Open
karneaud opened this issue Sep 8, 2018 · 4 comments
Open

Feature: return custom containment #197

karneaud opened this issue Sep 8, 2018 · 4 comments

Comments

@karneaud
Copy link

karneaud commented Sep 8, 2018

**feature request

Is there a way to return a rect object if not a function instead of an element in order to set the movement contraint?

e.g

new Draggabilly(elem, { 
  containment: { x: 20, y: 200, width: 400, height: 400 }
....
@desandro
Copy link
Owner

Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted.

@devberg
Copy link

devberg commented Sep 17, 2018

this should be a very-very usefull feature!!.. 👌

@arthurshlain
Copy link

Possible to make div inside parent div draggable in one way? For example, swipe push to the left/right side, hide notification at bottom of page by swipe down gesture...

@xfra35
Copy link

xfra35 commented Apr 3, 2020

This would be a very convenient feature.

Until it gets implemented, we can get a similar effect by passing an absolutely positioned element to the containment option:

var $containment=$('<div id="containment"></div>').css({
    position: 'absolute',
    left: '20px',
    top: '200px',
    width: '400px',
    height: '400px'
}).insertBefore($draggable);

$draggable.draggabilly({
    containment: $containment[0]
});

See a demo here.

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

No branches or pull requests

5 participants