jQuery UI 可拖动元素始终位于顶部
我需要从左侧区域拖动的元素始终位于顶部。当我第一次从左侧区域拖动它们时,它们是这样的,但是如果我将它们放入框 2,然后决定拖动到框 1,我拖动的项目会出现在框 1 下方。
感到困惑吗?这是我正在谈论的内容的DEMO。
是的,我添加了 zIndex ——没有帮助。
I need to have elements that are dragged from left-hand side area to be always on top. And they are when I first drag them from left area, however if I drop them into Box 2 and then decide to drag to Box 1, the item I drag appears below Box 1.
Confused? Here's DEMO of what I'm talking about.
Yes, I have added zIndex -- did not help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您正在做一些编辑。 :)
解决方案是将两个框设置为相同的 z-index,然后使用“start”事件降低同级框(卡片未覆盖的框)的 z-index。 “停止”事件应该使它们再次相等。当然,可拖动本身需要更高的 z-index。
您还可以尝试堆栈选项。
编辑:工作示例。 请注意,它实际上是可拖动的
drop< /code> 需要再次将 z 索引设置为相等的事件。
需要进行这些更改(当然,省略代码中的星号):
您
dragdrop-client.js
在
dragdrop-client.css
中Looks like you are doing some editing. :)
The solution is set the two boxes to the same z-index, and then lower the z-index of the sibling (the box the card is NOT over) using the "start" event. The "stop" event should set them equal again. Of course the draggable itself needs a higher z-index.
You can also try the stack option.
EDIT: Working example. Note that its actually the draggable
drop
event that needs to set the z-indexs equal again.You'll need to make these changes (omit asterisks in your code, of course):
In
dragdrop-client.js
In
dragdrop-client.css
当动态插入元素时,我会执行two7s_clash 建议的拖放操作。我们在画布上插入了一些元素,然后我们想要将其拖放到所有内容上:
I do what two7s_clash recommends for my drag-drop when elements are inserted dynamically. We have some elements being inserted over a canvas and then we want to drag n drop over everything: