From 1df198249a2c31367067ebeeedb34d1cbb60a61c Mon Sep 17 00:00:00 2001 From: Fadi Hania Date: Mon, 5 Jun 2023 22:42:31 +0300 Subject: [PATCH] Update search page style - Fix having multiple vertical scrollbars - Update icons lazy loading accordingly --- _includes/css/nerd-font-tweaks.scss | 4 ++-- cheat-sheet.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_includes/css/nerd-font-tweaks.scss b/_includes/css/nerd-font-tweaks.scss index c4610a1e1..7f198478b 100644 --- a/_includes/css/nerd-font-tweaks.scss +++ b/_includes/css/nerd-font-tweaks.scss @@ -110,9 +110,9 @@ a.nerd-font-button:before { } #main .nerd-font-cheat-sheet { - max-height: 520px; + // max-height: 520px; overflow-x: hidden; - overflow-y: scroll; + // overflow-y: scroll; margin-top: 40px; max-width: none; justify-content: center; diff --git a/cheat-sheet.js b/cheat-sheet.js index 99b247bc7..875a2a9b7 100644 --- a/cheat-sheet.js +++ b/cheat-sheet.js @@ -23,9 +23,12 @@ document.addEventListener('DOMContentLoaded', function () { } )); - elementGlyphCheatSheet.onscroll = function () { - const threshold = 10; - if ((elementGlyphCheatSheet.offsetHeight + elementGlyphCheatSheet.scrollTop + threshold) >= elementGlyphCheatSheet.scrollHeight) { + document.onscroll = function () { + const elementDoc = document.documentElement; + const elementIconsTop = elementGlyphCheatSheet.getBoundingClientRect().top + elementDoc.scrollTop; + + if (elementDoc.clientHeight + elementDoc.scrollTop >= + elementGlyphCheatSheet.clientHeight + elementIconsTop) { console.log("load more search results"); loadMoreSearchResults(); }