在其父文件中保留一个可拖动的div

编程入门 行业动态 更新时间:2024-10-23 07:23:23
本文介绍了在其父文件中保留一个可拖动的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

本文发布于:2023-10-23 02:09:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519427.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:拖动   其父   文件   div

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!