tablehead sticky au scroll
This commit is contained in:
@@ -34,6 +34,15 @@
|
||||
for (let otherTableTd of otherTableTds) {
|
||||
otherTableTd.style.width = `${100 / 8 * 1.75}%`;
|
||||
}
|
||||
// HEADER AU SCROLL
|
||||
let tableHead = document.querySelector("thead tr");
|
||||
let tHeadHeight = tableHead.offsetHeight;
|
||||
window.onscroll = () => {
|
||||
tableHead.style.minHeight = `${document.querySelector("header").offsetHeight + 72}px`;
|
||||
let scroll = window.pageYOffset;
|
||||
let headerNewHeight = tHeadHeight - scroll;
|
||||
tableHead.style.height = `${headerNewHeight}px`;
|
||||
}
|
||||
}, false);
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user