Animate transitions for UI's sortable list

半城伤御伤魂 提交于 2020-01-14 14:00:11

问题


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.


回答1:


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




回答2:


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
});


来源:https://stackoverflow.com/questions/12942520/animate-transitions-for-uis-sortable-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!