2
以下jQuery代码会在单击某些按钮时交换表行。我想知道如何添加转场效果,以便在移动一行时(而不是瞬间发生的变化)存在淡入或淡出过渡效果。我不确定在何处或如何应用转换!如何使用jQuery将转换效果添加到表行中
// Move item to top or up/down by one
$(".top,.up,.down").click(function(){
// This row
var row = $(this).parents("tr:first");
// When up is pressed
if ($(this).is(".up")) { row.insertBefore(row.prev()); }
// When top is pressed
else if ($(this).is(".top")) { var firstRow = row.parent().find("tr:first").not(row); row.insertBefore(firstRow); }
// When down is pressed
else { row.insertAfter(row.next()); }
我用淡出().insertbefore()。fadein()链接并在行移动后发生动画。在阅读这个答案http://stackoverflow.com/a/4369277/755404我解决了它... row.fadeOut(“slow”,function(){row.insertAfter(row.next())。fadeIn( “慢”); }); – Darren 2012-08-02 13:01:59