多个可调整大小的行为很奇怪

发布于 2024-09-04 17:23:45 字数 921 浏览 8 评论 0原文

我试图在一页上放置多个可调整大小和可拖动的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-09-11 17:23:45

这似乎是可拖动和可排序的错误,您会发现 解决方法在这里

this seems to be a bug with draggable and sortable you will find a workaround here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文