From c9b971bdf8888a7564ee6076fd8fcf473291e94a 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 --- framework/core/js/forum/src/components/index-page.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/core/js/forum/src/components/index-page.js b/framework/core/js/forum/src/components/index-page.js index c19234e8f..99f8897cb 100644 --- a/framework/core/js/forum/src/components/index-page.js +++ b/framework/core/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')),