Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animate transitions for UI's sortable list

I am working with an jQueryUI sortable list, and want to animate the transitions when lis are moved around as I drag an element up or down. As Apple have done it in their iPod app when rearranging a playlist's songs.

Is this possible? I've searched for hours, but cannot find anything useful.

like image 978
user1754406 Avatar asked Dec 05 '25 19:12

user1754406


2 Answers

I've put the code that user1754406 found on github into jsfiddle, it was just what I was looking for:

http://jsfiddle.net/samjones00/AbpJF/

Too much code to paste, please see the code on jsfiddle

like image 110
Sam Jones Avatar answered Dec 07 '25 09:12

Sam Jones


The revert option is what you want I think.

http://api.jqueryui.com/sortable/#option-revert

The jQuery documentation is very well written and it looks like they are in the process of making it even better. Their methods are also very robust and usually have at the very least some callback event you can tap into to perform things. Make sure you always look there first!

Oh in case you need it, your code adds options like this:

$( "#sortable" ).sortable({
     revert:300,
     //other options you need go here, comma separated
});
like image 22
Throttlehead Avatar answered Dec 07 '25 07:12

Throttlehead



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!