[英]IE not allowing tbody height to be set
我有以下這是一個大多數的CSS可滾動表。 在Chrome和Firefox中效果很好,但不會在IE 9中設置tbody元素的高度。
function scrollify(table,height){
table.find('thead').addClass('fixed_header');
table.find('tbody').addClass('scroll_content').height(height);
$('<div/>').addClass('table_wrap').appendTo(table.parent()).append(table);
}
CSS
.fixed_header th,tbody.scroll_content td{
display:block;
float:left;
width:3em;/*this is dynamically set in full function*/
}
.table_wrap{
float:left;
}
.fixed_header tr{
position:relative;
}
.scroll_content{
display:block;
overflow-y:scroll;
overflow-x:show;
}
似乎這只是IE不尊重tbody(或有關該表的height
css屬性的問題。 我一生無法為IE中的表格或tbody元素設置高度。 您可以在此答案中看到,最后一條評論提到它不適用於IE。
要設置ein元素的css高度,應使用css-function。 高度函數應用於做數學運算。
您在第二個小提琴中做了正確的選擇。 如果執行此操作,則應使用字符串作為參數來調用函數,然后調用單元:
scrollify($('table'), "300px");
編輯:似乎確實與高度和ie9有關。 innerHeight雖然應該工作。
我更新了小提琴: http : //jsfiddle.net/BvPNK/10/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.