我想用jQuery动画化表体jQuery的变化。
我有张桌子:
<table id="filterTable">
<tbody>
<td>name</td>
<td>surname</td>
</tbody>
</table>TBody被更改为AJAX,因此我有一个加载程序:
$('#filterTable tbody')
.ajaxStart(function() {
$(this).html('<tr class="filter-loading"><td colspan="5"> </td></tr>');
})
.ajaxStop(function() {
});加载程序只更改TBody的内容,而不使用动画(只需用单个加载程序行更改表行)。是一个类"filter-loading“,它保存背景图像(是加载程序映像)。
.filter-loading {
height: 300px;
}
.filter-loading td {
background: url(../images/loading-small.gif) #ffffff no-repeat 18px 18px;
background-position: center;
}我希望在所有表行上实现简单的淡出效果,在加载程序行上实现淡出效果。装载机行的高度将调整为300 to。
问题是我无法更改内容.我尝试过“完全”函数,但是加载程序行在AJAX响应之后仍然保留。在没有动画加载器的情况下,行将被AJAX响应内容替换。
谢谢你提前帮忙。
发布于 2012-06-26 19:02:01
试试看
css:
#filterTable {
display:block; // for animation - important(tables not animated)
}联署材料:
var table = '#filterTable tbody';
var loader = '#filterTable tbody .filter-loading';
$("your_selector").your_event(function() {
$(table).animate({"opacity": 0}, function() {
$(this).html('<tr class="filter-loading"><td colspan="5"> </td></tr>')
.find(".filter-loading")
.css("opacity", 0)
.animate({"opacity": 1});
});
$.ajax({
url: your_url,
success: function(data) {
$(loader).animate({"opacity": 0}, function() {
$(this).remove();
$(table).html("your data rows");
});
},
error: function(xhr, status, errorThrown) {
$(loader).animate({"opacity": 0}, function() {
$(this).remove();
});
alert("sorry");
}
});
});https://stackoverflow.com/questions/11213019
复制相似问题