From c95b8838ac661a9a8ca8d0876e59bb47f7583ef9 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 21 May 2015 08:15:58 +0930 Subject: [PATCH] Maintain scroll position relative to bottom of hero when switching categories --- framework/core/js/forum/src/components/index-page.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/core/js/forum/src/components/index-page.js b/framework/core/js/forum/src/components/index-page.js index 87e0459bb..bd6356bf5 100644 --- a/framework/core/js/forum/src/components/index-page.js +++ b/framework/core/js/forum/src/components/index-page.js @@ -129,8 +129,14 @@ export default class IndexPage extends Component { $('body').removeClass('index-page'); } + + var heroHeight = this.$('.hero').css('height', '').outerHeight(); var scrollTop = app.cache.scrollTop; - $(window).scrollTop(scrollTop); + + $('.global-page').css('min-height', $(window).height() + heroHeight); + $(window).scrollTop(scrollTop - (app.cache.heroHeight - heroHeight)); + + app.cache.heroHeight = heroHeight; if (this.lastDiscussion) { var $discussion = this.$('.discussion-summary[data-id='+this.lastDiscussion.id()+']');