多个可调整大小的行为很奇怪
我试图在一页上放置多个可调整大小和可拖动的 div,这些 div 在其自己的父 div 内(垂直)移动。 你可以看看 http://bit.ly/bCutBE
但是,当我想要调整它们的大小,尤其是从北侧,它们会非常快地移出屏幕,而它们不应该能够超出父 div 之外。 我只希望 div 能够在其父级内部垂直移动和调整大小,拖动部分效果很好,但调整大小部分会出现此问题。
我实在无法比这更好地描述它,但是您自己看一下,当您尝试调整其中一个彩色 div 的大小时,您会立即清楚:将其向下移动一点并尝试从北侧调整它的大小。
该问题似乎是由包含:'parent',可调整大小的行引起的。当我删除这一行时,它工作正常,但是彩色块不会留在其父级中,我希望它们留在其父级中。
我希望有人能帮我解决这个问题...
我使用的 jquery 代码:
$(document).ready(function(){
$(".move")
.draggable({
containment: 'parent',
grid: [50,50],
axis: 'y'
})
.resizable({
containment: 'parent',
grid: [50,50],
handles: 'n, s',
minHeight: 50
});
});
I'm trying to place multiple resizable and draggable div's on one page that move (vertically) inside their own parent div.
you can take a look at http://bit.ly/bCutBE
However, these div's act really strange when I want to resize them, especially from the north side, they kind of move out of the screen very fast, while they shouldn't be able to get outside the parent div.
I only want the div to be able to move and resize vertically inside it's parent, the dragging-part works pretty good, but the resize part give this problem.
I can't really describe it better than this, but take a look for yourself and it will be clear immediately when you try to resize one of the coloured div's: move it a little downwards and try to resize it from the north side.
the problem seems to be caused by the containment: 'parent', line of the resizable. when I delete this line it works fine, but then the coloured blocks don't stay in their parent, and I want them to stay inside their parent.
I hope someone can help me with this...
the jquery code I used:
$(document).ready(function(){
$(".move")
.draggable({
containment: 'parent',
grid: [50,50],
axis: 'y'
})
.resizable({
containment: 'parent',
grid: [50,50],
handles: 'n, s',
minHeight: 50
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是可拖动和可排序的错误,您会发现 解决方法在这里
this seems to be a bug with draggable and sortable you will find a workaround here