本文介绍了在其父文件中保留一个可拖动的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个可拖动的div标签,而且我想要拖动这个不会从其父项溢出的div。 C $ C><脚本> $('。children')。resizeable()。draggable(); // from jquerUI < / script> < style> .parent { overflow:hidden; 职位:亲属; width:1000px; height:1000px; } .children { width:100px; height:100px; 位置:绝对; } < / style> < div class =parent> < div class =children>< div> < / div>
我如何保留,限制孩子在父母的位置和大小。 / p>
解决方案$('。children')。draggable({containment:parent} );
I have got a draggable div tag.And i 'd like to while i drag this div which will not overflow from its parent.
<script> $('.children').resizeable().draggable();//from jquerUI </script> <style> .parent{ overflow: hidden; position: relative; width: 1000px; height: 1000px; } .children{ width: 100px; height: 100px; position: absolute; } </style> <div class="parent"> <div class="children"><div> </div>How can i keep,limit children's position and size inside parent.Sorry because of my bad English.
解决方案 $('.children').draggable({ containment: "parent" });
更多推荐
在其父文件中保留一个可拖动的div
发布评论