From 989c915a0226ee22356732ad85f799b736bf8e92 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 31 Aug 2015 15:04:33 -0400 Subject: [PATCH] FIX: Custom header sizes and scrolling with menu panels --- .../javascripts/discourse/components/menu-panel.js.es6 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/components/menu-panel.js.es6 b/app/assets/javascripts/discourse/components/menu-panel.js.es6 index f8e2c9f80b7..2cf682a5dd2 100644 --- a/app/assets/javascripts/discourse/components/menu-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/menu-panel.js.es6 @@ -39,7 +39,8 @@ export default Ember.Component.extend({ $panelBody.height(contentHeight); } else { $panelBody.height('auto'); - const headerHeight = parseInt($('header.d-header').height() + 3); + const $header = $('header.d-header'); + const headerHeight = parseInt($header.height() + $header.offset().top - $(window).scrollTop() + 3); this.$().css({ left: "auto", top: headerHeight + "px" }); } }, @@ -69,9 +70,11 @@ export default Ember.Component.extend({ }); this.performLayout(); this._watchSizeChanges(); + $(window).on('scroll.discourse-menu-panel', () => this.performLayout()); } else { Ember.run.scheduleOnce('afterRender', () => this.sendAction('onHidden')); $('html').off('click.close-menu-panel'); + $(window).off('scroll.discourse-menu-panel'); this._stopWatchingSize(); } }, @@ -162,6 +165,7 @@ export default Ember.Component.extend({ $('body').off('keydown.discourse-menu-panel'); $('html').off('click.close-menu-panel'); $(window).off('resize.discourse-menu-panel'); + $(window).off('scroll.discourse-menu-panel'); }, hide() {