diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js index ad933e369a1..27000cfd48d 100644 --- a/addons/website/static/src/js/content/menu.js +++ b/addons/website/static/src/js/content/menu.js @@ -74,6 +74,7 @@ const BaseAnimatedHeader = animations.Animation.extend({ */ _adaptToHeaderChange: function () { this._updateMainPaddingTop(); + this.el.classList.toggle('o_top_fixed_element', this.fixedHeader && this._isShown()); const bottom = this.el.getBoundingClientRect().bottom || (this.el.nextElementSibling.getBoundingClientRect().top + window.scrollY); @@ -116,6 +117,12 @@ const BaseAnimatedHeader = animations.Animation.extend({ _computeTopGap() { return 0; }, + /** + * @private + */ + _isShown() { + return true; + }, /** * @private * @param {boolean} [useFixed=true] @@ -123,7 +130,6 @@ const BaseAnimatedHeader = animations.Animation.extend({ _toggleFixedHeader: function (useFixed = true) { this.fixedHeader = useFixed; this.el.classList.toggle('o_header_affixed', useFixed); - this.el.classList.toggle('o_top_fixed_element', useFixed); this._adaptToHeaderChange(); }, /** @@ -210,6 +216,12 @@ publicWidget.registry.StandardAffixedHeader = BaseAnimatedHeader.extend({ // Handlers //-------------------------------------------------------------------------- + /** + * @override + */ + _isShown() { + return !this.fixedHeader || this.fixedHeaderShow; + }, /** * Called when the window is scrolled * @@ -232,6 +244,7 @@ publicWidget.registry.StandardAffixedHeader = BaseAnimatedHeader.extend({ if (this.fixedHeaderShow !== reachPosScrolled) { this.$el.css('transform', reachPosScrolled ? `translate(0, -${this.topGap}px)` : 'translate(0, -100%)'); this.fixedHeaderShow = reachPosScrolled; + this._adaptToHeaderChange(); } }, }); @@ -295,6 +308,12 @@ const BaseDisappearingHeader = publicWidget.registry.FixedHeader.extend({ _hideHeader: function () { this.$el.trigger('odoo-transitionstart'); }, + /** + * @override + */ + _isShown() { + return !this.fixedHeader || !this.hiddenHeader; + }, /** * @private */