FIX: Custom header sizes and scrolling with menu panels

This commit is contained in:
Robin Ward 2015-08-31 15:04:33 -04:00
parent e5911e7fc4
commit 989c915a02
1 changed files with 5 additions and 1 deletions

View File

@ -39,7 +39,8 @@ export default Ember.Component.extend({
$panelBody.height(contentHeight); $panelBody.height(contentHeight);
} else { } else {
$panelBody.height('auto'); $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" }); this.$().css({ left: "auto", top: headerHeight + "px" });
} }
}, },
@ -69,9 +70,11 @@ export default Ember.Component.extend({
}); });
this.performLayout(); this.performLayout();
this._watchSizeChanges(); this._watchSizeChanges();
$(window).on('scroll.discourse-menu-panel', () => this.performLayout());
} else { } else {
Ember.run.scheduleOnce('afterRender', () => this.sendAction('onHidden')); Ember.run.scheduleOnce('afterRender', () => this.sendAction('onHidden'));
$('html').off('click.close-menu-panel'); $('html').off('click.close-menu-panel');
$(window).off('scroll.discourse-menu-panel');
this._stopWatchingSize(); this._stopWatchingSize();
} }
}, },
@ -162,6 +165,7 @@ export default Ember.Component.extend({
$('body').off('keydown.discourse-menu-panel'); $('body').off('keydown.discourse-menu-panel');
$('html').off('click.close-menu-panel'); $('html').off('click.close-menu-panel');
$(window).off('resize.discourse-menu-panel'); $(window).off('resize.discourse-menu-panel');
$(window).off('scroll.discourse-menu-panel');
}, },
hide() { hide() {