Skip to content

Commit bcc07a3

Browse files
committed
sticky table header
1 parent 0deb010 commit bcc07a3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/htmlcmp/compare_output_server.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def badge(result: str | None) -> str:
428428
.btn:hover { background: #f1f3f4; }
429429
table { width: 100%; border-collapse: collapse; }
430430
thead th {
431-
position: sticky; top: 0; z-index: 1;
431+
position: sticky; top: var(--header-h, 0px); z-index: 1;
432432
text-align: left; font-size: 12px; color: var(--muted);
433433
font-weight: 600; padding: 8px 12px; background: #f8f9fa;
434434
border-bottom: 1px solid var(--border);
@@ -546,6 +546,13 @@ def badge(result: str | None) -> str:
546546
} catch (e) {}
547547
}
548548
549+
function syncHeaderHeight() {
550+
const h = document.querySelector("header").offsetHeight;
551+
document.documentElement.style.setProperty("--header-h", h + "px");
552+
}
553+
syncHeaderHeight();
554+
window.addEventListener("resize", syncHeaderHeight);
555+
549556
updateSummary();
550557
if (LIVE) setInterval(poll, 1500);
551558
</script>

0 commit comments

Comments
 (0)