简体   繁体   中英

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. 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. Thanks

First should look like: http://jsfiddle.net/3CM2M/

after switch: http://jsfiddle.net/3CM2M/1/

$(dropObjects).draggable({ 
        axis: "x", 
        zIndex: 100});

You can use the sortable feature of jQuery UI with draggable .

$( ".selector" ).draggable({ connectToSortable: "#my-sortable" });

Here is the working example and the corresponding documentation (connectToSortable) in jQuery UI's official website.

And here is the detailed information about:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM