如何阻止堆叠元素? jQueryUI的 [英] how to stop elements from stacking? jqueryui

查看:128
本文介绍了如何阻止堆叠元素? jQueryUI的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有一个例子:
http://jsfiddle.net/BAk9N/4/

我试图让它成为test元素,不能在其他测试元素和堆栈之上拖动,并且找不到工作解决方案。 / p>

有没有人有关于如何防止测试元素彼此堆叠的想法?

谢谢。 / p>

我可以看到的一个原因是捕捉的原因是你的li之间的边距很有趣。 // margin:10px; 来自 .meals li css,而不是它捕捉到元素的中间。我会觉得你将不得不提出自己的贴合解决方案。



这也是我为一个人做的一个小提琴与另一个问题半相似,这可能会帮助你在自定义捕捉解决方案。



在这里演示: JsFiddle


I have an example here: http://jsfiddle.net/BAk9N/4/

I'm trying to make it so "test' elements can not drag on top of other test elements and stack and have not found a working solution.

Does anyone have any ideas on how to prevent test elements from stacking on each other?

Thank you.

解决方案

The one thing I can see is the reason the snapping is acting so funny is the margins between your li's. If you take off the //margin: 10px; from the .meals li css than it snaps to the middle of the element. I would recommend taking that off. Otherwise I feel like you're going to have to come up with your own snapping solution.

Also this is a fiddle I made for a person with another question semi-similar to this. This may help you out in a custom snapping solution.

Demo here: JsFiddle

这篇关于如何阻止堆叠元素? jQueryUI的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆