question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restrict a draggable within a div

See original GitHub issue

Hi, I’d like to be able to restrict the dragging of an element to within a div, something like:

.restrict({
    drag: document.getElementById('container'),
})

Is there a way to do this?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
adlaigordoncommented, Nov 2, 2014

That works, thanks!

0reactions
BryanCalubcommented, Oct 10, 2018

hi @taye you know how to fix this. I’m using @odahcam code this the link https://codepen.io/odahcam/pen/gRqKJj?editors=0010),

untitled

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery draggable: how to limit the draggable area?
The problem is that with this the user can drag the div anywhere on the screen, including out of the droppable area. How...
Read more >
Limit the Draggable area using jQuery UI - EncodeDna.com
We can restrict the draggable area. It is simple. All you have to do is, add an option called containment to the draggable()...
Read more >
Limit Draggable area in jQuery UI - CodeSpeedy
There is an option we can set to the draggable method to limit the area of dragging the element within a parent element....
Read more >
How to limit Draggable X or Y amount - GSAP - GreenSock
When dragging, I divide the amount of movement by that value, giving me a ratio. I then multiply the width of the slider...
Read more >
Restrict the Drag operation of an Element to its Container ...
I have declared an element 'ele' inside a container 'outer'. Observe how I have set the containment option to “parent”. This constrains dragging...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found