From 94c1124bd020c766106702f5c45d56dba662b221 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 24 Jan 2019 16:08:31 -0500 Subject: [PATCH] fix overlay scrollbars covering one-line scrolled code blocks. fixes #5. --- _layouts/spec.html | 6 ++++++ assets/style.css | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/_layouts/spec.html b/_layouts/spec.html index 4ade375..ea45459 100644 --- a/_layouts/spec.html +++ b/_layouts/spec.html @@ -79,6 +79,12 @@ toggleClass(document.querySelector('.toc'), "open"); }); + document.querySelectorAll('pre').forEach((e) => { + if (e.scrollWidth > e.clientWidth /* && e.clientHeight < 30*/) { + toggleClass(e, "has-scroll"); + } + }); + // need this part to fix toc offset height if content above toc changes height var resizeTimer; diff --git a/assets/style.css b/assets/style.css index 480c858..07563b6 100644 --- a/assets/style.css +++ b/assets/style.css @@ -210,4 +210,11 @@ dt { } dd + dt { margin-top: 10px; -} \ No newline at end of file +} + +/* add padding to compensate for overlay scrollbars on mac.*/ +/* overlay scrollbars on one-line-high code blocks hide the code */ +/* ideally id only target mac but idk how */ +.has-scroll { + padding-bottom: 13px; +}