Skip to content

Commit

Permalink
added conditional fade to right sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Astromations authored Jul 6, 2023
1 parent f628f16 commit c1a3edb
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions hazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,19 +438,16 @@
});
});

waitForElement([".Root__nav-right-sidebar .os-viewport.os-viewport-native-scrollbars-invisible"], ([scrollNode]) => {
scrollNode.setAttribute("fade", "bottom");
scrollNode.addEventListener("scroll", () => {
// fade
if (scrollNode.scrollTop == 0) {
scrollNode.setAttribute("fade", "bottom");
} else if (scrollNode.scrollHeight - scrollNode.scrollTop - scrollNode.clientHeight == 0) {
scrollNode.setAttribute("fade", "top");
} else {
scrollNode.setAttribute("fade", "full");
}
});
});
waitForElement([".Root__right-sidebar .os-viewport.os-viewport-native-scrollbars-invisible"], ([scrollNode]) => {
scrollNode.addEventListener("scroll", () => {
if (scrollNode.scrollTop == 0) {
sideFade = '0%'
} else {
sideFade = '5%'
}
document.documentElement.style.setProperty('--side-fade', sideFade);
});
});
}

const config = {}
Expand Down

0 comments on commit c1a3edb

Please sign in to comment.