我有一張有六列的表格。我試圖先讓中間的兩列隱藏起來,但是當你點擊一個按鈕時,他們會將其他內容推出。現在我正在嘗試將它們隱藏在具有-z-index和絕對位置的另一列之後。我無法讓jquery動畫過渡。這是代碼。它消除了這個位置:絕對的和所有的,但它確實有一個很酷的轉換。在HTML只是一個表,其中TH的有ID並且細胞具有頭..如何在jquery中將表列慢慢向右移動?
css:
.hid{
position: absolute;
z-index: -50;
}
和繼承人的jQuery
$("button#expand").live('click',function(){
cols =$("#col-1, [headers=col-1], #col-2, [headers=col-2] ");
///this variable gets all the cells of the table column for both 1 and 2
if($(cols).hasClass("hid")){
$(cols).removeClass("hid");
//this works but it doesnt slide
$("button#expand").html("Hide");
}
我不認爲這是可能的動畫表行或列的動畫。您必須使用看起來像表格行/列的單個div。 – Blazemonger
我第二次開火,但會建議實際重繪表格,而不是僅僅爲了訪問原因調整'div's –