jQuery UI Sortable:拖动的元素消失

发布于 2024-10-08 09:03:58 字数 306 浏览 0 评论 0原文

我设置了

.sortable(),容器中有一些元素。

当我拖动内部元素时,打算将该元素与其他元素一起排序,一旦将其拖出容器,就看不到

但当我把它放入占位符时,它又可以看到了。 在线案例在这里

有人以前遇到过这个问题吗?或者任何人都可以帮助我解决这个问题吗?

谢谢

I set the <div class="container"> .sortable(), and there are some elements in the container.

When I drag the inner element, intend to sort the element with the others, once the dragged one out the container, it can not be seen.

But when I drop it into place holder, it could be seen again. Online case is here.

Anyone have met the problem before? Or anyone can help me with the problem?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

半世晨晓 2024-10-15 09:03:58

overflow:hidden; 放到 .container 上,它就会起作用。问题是,在拖动过程中,您将 .container 的子级移动到 .container 元素之外,您已经告诉浏览器隐藏任何溢出。在拖动期间重新强制溢出,并且浏览器正在执行您告诉它执行的操作。

一般建议:保留 overflow 除非您知道它的作用以及为什么需要使用它。

Drop the overflow: hidden; on .container and it will work. The problem is that during the drag you're moving a child of .container outside of the .container element, you've told the browser to hide any overflow while you're forcing an overflow during the drag and the browser is doing what you told it to do.

General advice: leave overflow alone unless you know what it does and why you need to use it.

孤独陪着我 2024-10-15 09:03:58

技巧是将帮助程序设置为 'clone' 并使用临时交换列表进行拖动..代码的修改版本 此处

$( ".selector" ).sortable({
    helper: "clone"
});

the trick is to set helper to 'clone' and use a temporary swaplist for the drag.. modified version of your code here

$( ".selector" ).sortable({
    helper: "clone"
});
妄想挽回 2024-10-15 09:03:58

我拖动的项目在垂直列表中消失,我发现使用溢出-y:隐藏而不是溢出:隐藏对我有用。即仅针对 y 轴。

My dragged items were disappearing in a vertical list and I found that using overflow-y: hidden instead of overflow:hidden worked for me. i.e. only target the y axis.

谈场末日恋爱 2024-10-15 09:03:58

问题很可能是由于以下原因造成的: .container{ margin:0 20px;位置:绝对;顶部:0;高度:100%;宽度:280px;溢出:隐藏;}

如果您设置了overflow:auto,它会显示带有滚动条的包装器div,您可以查看您的portlet。

most probably the problem is due to this: .container{ margin:0 20px; position:absolute;top:0;height:100%;width:280px;overflow:hidden;}.

If you set overflow:auto it shows the wrapper div with scrollbar and you can view your portlet.

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