Use the “containment” option:
jQuery UI API – Draggable Widget – containment
The documentation says it only accepts the values: 'parent'
, 'document'
, 'window'
, [x1, y1, x2, y2]
but I seem to remember it will accept a selector such as ‘#container’ too.
More Related Contents:
- jQuery Drag And Drop Using Live Events
- jQuery draggable shows helper in wrong place after page scrolled
- Restrict jQuery draggable items from overlapping/colliding with sibling elements
- How can I make a jQuery UI ‘draggable()’ div draggable for touchscreen?
- jQuery UI – Draggable is not a function?
- Draggable div without jQuery UI
- jQuery draggable + droppable: how to snap dropped element to dropped-on element
- Draggable revert if outside this div and inside of other draggables (using both invalid and valid revert options)
- How to change the bootstrap css width into 1000px? [closed]
- How to access the content of an iframe with jQuery?
- How to fire loadComplete after new row is added in jqgrid?
- jQuery AJAX Character Encoding
- jQuery Set Select Index
- How do I change selected value of select2 dropdown with JqGrid?
- How do I implement onchange of with jQuery?
- Choosing a jQuery datagrid plugin? [closed]
- Can jQuery add commas while user typing numbers?
- How can I remove script elements before they are being executed?
- jQuery Validation plugin won’t validate when in click event handler of
- Dynamically add a class to Bootstrap’s ‘popover’ container
- How do I select a sibling element using jQuery?
- JQuery Animate Background Image on Y-axis
- why doesn’t Jqgrid frozen column seem to work with filter rows and filter heading?
- addID in jQuery?
- bootstrap-typeahead.js add a listener on select event
- jQuery trigger custom event synchronously?
- How to refresh the src of with jQuery?
- The .fadeOut() method to use visibility property instead of display property
- Load content with ajax in bootstrap modal
- Can jQuery selectors be used with DOM mutation observers?