From 9d8afce20430eab9f78173db554b3f3ad01cdff0 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 18 May 2015 14:47:08 +0930 Subject: [PATCH] Don't affix the sidebar if it is taller than the viewport. fixes #79 --- js/forum/src/components/index-page.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/forum/src/components/index-page.js b/js/forum/src/components/index-page.js index c19234e8f..99f8897cb 100644 --- a/js/forum/src/components/index-page.js +++ b/js/forum/src/components/index-page.js @@ -225,6 +225,11 @@ export default class IndexPage extends Component { affixSidebar(element, isInitialized) { if (isInitialized) { return; } var $sidebar = $(element); + + // Don't affix the sidebar if it is taller than the viewport (otherwise + // there would be no way to scroll through its content). + if ($sidebar.outerHeight(true) > $(window).height() - $('.global-header').outerHeight(true)) return; + $sidebar.find('> ul').affix({ offset: { top: () => $sidebar.offset().top - $('.global-header').outerHeight(true) - parseInt($sidebar.css('margin-top')),