[英]Switching div content with another div content position
i wonder if there is a way of switching position of draggable div content with position of drop div content. 我想知道是否有一种方法可以将可拖动div内容的位置与放置div内容的位置切换。 I have 6 draggable divs wich has img and p tags in. What i need is to switch position when i drag over another div.
我有6个可拖动的div,其中包含img和p标签。我需要的是在我拖动另一个div时切换位置。 Thanks
谢谢
First should look like: http://jsfiddle.net/3CM2M/ 首先应该看起来像: http : //jsfiddle.net/3CM2M/
after switch: http://jsfiddle.net/3CM2M/1/ 切换后: http : //jsfiddle.net/3CM2M/1/
$(dropObjects).draggable({
axis: "x",
zIndex: 100});
You can use the sortable
feature of jQuery UI with draggable
. 您可以将jQuery UI的
sortable
功能与draggable
。
$( ".selector" ).draggable({ connectToSortable: "#my-sortable" });
Here is the working example and the corresponding documentation (connectToSortable) in jQuery UI's official website. 这是jQuery UI官方网站中的工作示例和相应的文档(connectToSortable) 。
And here is the detailed information about: 以下是有关的详细信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.