0
我其實在做這個table,我需要固定在桌子上的頭thead
的頂部,當你滾動表。在我的情況下,我需要通過JS或jQuery修復它,我不能編輯表格的HTML。如何在頂級表THEAD修復與JS
我試着用這個腳本沒有結果:
<script>
document.getElementById("tablepress-10").addEventListener("scroll", function() {
var translate = "translate(0," + this.scrollTop + "px)";
this.querySelector("thead").style.transform = translate;
});
</script>
這是HTML:
<div id="tablepress-10_wrapper">
<table>...</table>
</div>
這是CSS:
#tablepress-10_wrapper {
overflow: auto !important;
height: 400px !important;
}
的是我寫的不對任何想法?有小費嗎?
感謝您的建議。
PS:我使用WordPress的
是[這](https://stackoverflow.com/questions/38611581/fix-table-thead)你? –
按照此鏈接,您將能夠解決您的問題。 http://stackoverflow.com/questions/673153/html-table-with-fixed-headers –
和[this](http://stackoverflow.com/questions/38608935/fix-table-header-thead) –