实现原理,通过position+jquery克隆dom+jquery anamite实现位置互换效果。代码如下
moveupAnimate: (dom, prevItem, speed) => {
var domTop = dom.position().top;
var prevTop = prevItem.position().top;
dom.css('visibility', 'hidden');
prevItem.css('visibility', 'hidden');
dom.clone().insertAfter(dom).css({ position: 'absolute', visibility: 'visible', top: domTop }).animate({ top: prevTop }, speed, function () {
$(this).remove();
dom.insertBefore(prevItem).css('visibility', 'visible');
});
prevItem.clone().insertAfter(prevItem).css({ position: 'absolute', visibility: 'visible', top: prevTop }).animate({ top: domTop }, speed, function () {
$(this).remove();
prevItem.css('visibility&#