如何在html中释放表中的表头

how to freez header in a table in html

本文关键字:表头 释放 html      更新时间:2024-03-12

这里,我有一个表,我想在滚动时修复这个标题

JS

<script>
$('#scroll').scroll(function(){
if ($('#scroll').scrollTop() > 10){
    $("thead").css({
            position: 'fixed',
            top: '68px'
        });
}else{
    $('thead').css({
        position: 'static'
    });
}
});
</script>

这是完美的工作,但设计正在改变。

LIVE DEMO - http://testing.twomini.com/

Fiddle

有人能帮我吗。

提前谢谢。

将位置更改为"静态"

$("thead").css({
    position: 'static',
    top: '68px'
});