Fix rendering of new rail
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var rail = document.querySelector(".right-rail");
|
||||
if (!rail) return;
|
||||
var header = document.querySelector("header");
|
||||
if (!header) return;
|
||||
function updateTop() {
|
||||
if (getComputedStyle(rail).position !== "fixed") {
|
||||
rail.style.top = "";
|
||||
return;
|
||||
}
|
||||
var rect = header.getBoundingClientRect();
|
||||
rail.style.top = Math.max(8, rect.bottom + 8) + "px";
|
||||
}
|
||||
window.addEventListener("scroll", updateTop, { passive: true });
|
||||
window.addEventListener("resize", updateTop);
|
||||
updateTop();
|
||||
});
|
||||
Reference in New Issue
Block a user