我使用下面的代码向下滑动一行,但是 jQuerydisplay: block
在该行上强制执行,当它应该是 时table-row
,会破坏样式。
小提琴:http: //jsfiddle.net/7Ay3z/
我在完成后手动将其设置为table-row
,但这太可怕了。我该如何解决这个问题?
<style>
table {
margin: 25px;
}
tr {
background-color: #c00;
color: #fff;
border: 1px solid #000;
padding: 10px;
}
</style>
<table>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
<td style="display:none;">1</td>
</tr>
</table>
问:
$("tr").click(function(){
var row = $(this);
var visibleLength = row.find("td:visible").length;
var hiddenLength = row.find("td:not(:visible)").length;
var drillRow = $("<tr/>").addClass("drillDownRow");
var drillColumn = $("<td/>").attr("colspan", visibleLength);
var drillHidden = $("<td/>").attr("colspan", hiddenLength).css({display: "none"});
drillColumn.html("test <b>2</b>... ok");
drillRow.hide().append(drillColumn).append(drillHidden).insertAfter(row);
drillRow.slideDown("slow",function() {$(this).css({display: "table-row"})});
});