jQuery可拖动-允许包含多个容器? [英] JQuery draggable - allow containment to multiple containers?

查看:147
本文介绍了jQuery可拖动-允许包含多个容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望允许用户将一个元素从一个容器拖到另一个容器,同时仍然无法将元素拖到这两个容器中的任何一个之外.除了可以将其拖到另一个容器的那一部分之外,我的所有其他工具都工作正常.

在JSFiddle.net上查看代码和结果

我认为这篇文章似乎是答案,但它似乎对我不起作用.

解决方案

我在您的小提琴中添加了一个jQuery UI droppable.稍加调整,我相信您将能够按照自己的意愿获得此功能.

http://jsfiddle.net/U2nKh/20/

I'd like to allow users to drag an element from one container to another while still being constrained from being able to drag the element outside of either of those two containers. I have everything working perfectly except the part where they can drag to another container.

View code and result on JSFiddle.net

I thought this post seemed like the answer but it doesn't appear to work for me.

解决方案

I added a jQuery UI droppable to your fiddle. With a little bit of tweaking I'm sure you'd be able to get this exactly how you want it.

http://jsfiddle.net/U2nKh/20/

这篇关于jQuery可拖动-允许包含多个容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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