My HTML is:
<div id="inside">
<p id="drag">drag me </p>
</div>
and jQuery code is:
$('#drag').draggable({containment: 'parent'});
It is not working. It is only moving along the y axis, as if it is reacting to {axis: 'y'}
.
It is even reacting the same way for {containment: 'document'}
and {containment: 'window'}
You might not be setting the properties of the elements properly. A working fiddle:
<div class="container">
<p id="draggable">I'm contained within my parent</p>
</div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.