Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 3 个 div(可拖动),每个都在它的(容器)div 中。我可以使用“包含”来限制一个 div 的移动,但是当 3 个具有相同的类时,它就不起作用了。关于如何工作的任何帮助?这是一个快速的小提琴:
http://jsfiddle.net/B63Px/8/
当您提供选择器作为容器时,它只包含与选择器匹配的第一个元素。
除非我有误解,否则您似乎想根据其父级来包含 div。在这种情况下,您应该使用
containment: "parent"
您可以在 jsFiddle 上看到这一点。