i am actually working on this table and i need to fix on top of the table the header thead
when you scroll the table. In my case i need to fix it via JS or jQuery and i can't edit the HTML of the table.
I tried with this script without results:
<script>
document.getElementById("tablepress-10").addEventListener("scroll", function() {
var translate = "translate(0," + this.scrollTop + "px)";
this.querySelector("thead").style.transform = translate;
});
</script>
This is the HTML:
<div id="tablepress-10_wrapper">
<table>...</table>
</div>
This is the CSS:
#tablepress-10_wrapper {
overflow: auto !important;
height: 400px !important;
}
Any ideas of what i wrote wrong? Any tips?
Thanks in advice.
PS: I am using Wordpress