diff options
author | Phil Hughes <me@iamphill.com> | 2017-12-08 12:11:54 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-12-08 12:11:54 +0300 |
commit | 1d4a2d2ad167e4b50ddfc94114e98fa4da4a6c5a (patch) | |
tree | a8f463a48081b2eb1cb8e71bc8d2869369af6a9d /content | |
parent | 1444e0557e028b16303bd7fc2dfb24837a50d8b6 (diff) |
Fixed sidebar becoming fixed on smaller screens
Closes #148
Diffstat (limited to 'content')
-rw-r--r-- | content/assets/javascripts/docs.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/content/assets/javascripts/docs.js b/content/assets/javascripts/docs.js index e9070f2b..ae70aad0 100644 --- a/content/assets/javascripts/docs.js +++ b/content/assets/javascripts/docs.js @@ -44,6 +44,8 @@ function toggleNavigation() { var sidebarHeight = sidebar.querySelector('ul').getBoundingClientRect().height + 55; document.addEventListener('scroll', function() { + if (window.innerWidth < 1099) return; + if (window.scrollY + sidebarHeight >= main[0].offsetHeight) { sidebar.style.position = 'absolute'; sidebar.style.top = (main[0].offsetHeight - sidebarHeight) + 'px'; @@ -51,7 +53,7 @@ function toggleNavigation() { sidebar.style.position = ''; sidebar.style.top = ''; } - }); + }, { passive : true }); } // remove what is left of the old navigation |