Reputation: 387
I have two divs, the parent is smaller then it's child. I want to have the child's drag limit to the border of the container. However, this does not seem to work with the usual containment object. How could I do this properly?
Example: http://jsfiddle.net/Lr0s3tj7/
<div class='wrap'> <!-- smaller then child -->
<div class='inner'> <!-- larger then parent -->
</div>
</div>
Upvotes: 0
Views: 155
Reputation: 465
use array to define the border should do the trick
$(".inner").draggable({
axis: 'x',
containment: [-100, 0, 0, 200 ],
revert: true
});
edited the answer to meet the requirement
Upvotes: 1