summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/content/menu.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-09-22 13:02:13 +0000
committerqsm-odoo <qsm@odoo.com>2020-09-23 09:44:12 +0000
commit1ec7cd3aafccb2acc641eed081fad70dee211ac5 (patch)
tree24298d58b37b491e3206b0823f366561ebe56ec0 /addons/website/static/src/js/content/menu.js
parentd73dfc635860aa75e75c767344022262458b963c (diff)
[FIX] website: handle affixed header in full screen mode
The affixed header was not properly repositioned in editor full screen mode (introduced in 13.4). closes odoo/odoo#58247 X-original-commit: 7502c8aa6e5422b1ecf446002e187fa2f7ca3aa7 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static/src/js/content/menu.js')
-rw-r--r--addons/website/static/src/js/content/menu.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js
index bcf9ebbaf78..70ed4565185 100644
--- a/addons/website/static/src/js/content/menu.js
+++ b/addons/website/static/src/js/content/menu.js
@@ -72,6 +72,18 @@ const BaseAnimatedHeader = animations.Animation.extend({
/**
* @private
*/
+ _adaptFixedHeaderPosition() {
+ // Compensate scrollbar
+ this.el.style.removeProperty('right');
+ if (this.fixedHeader) {
+ const scrollableEl = this.$el.parent().closestScrollable()[0];
+ const style = window.getComputedStyle(this.el);
+ this.el.style.setProperty('right', `${parseInt(style['right']) + scrollableEl.offsetWidth - scrollableEl.clientWidth}px`, 'important');
+ }
+ },
+ /**
+ * @private
+ */
_adaptToHeaderChange: function () {
this._updateMainPaddingTop();
this.el.classList.toggle('o_top_fixed_element', this.fixedHeader && this._isShown());
@@ -128,14 +140,7 @@ const BaseAnimatedHeader = animations.Animation.extend({
_toggleFixedHeader: function (useFixed = true) {
this.fixedHeader = useFixed;
this.el.classList.toggle('o_header_affixed', useFixed);
- // Compensate scrollbar
- if (useFixed) {
- const scrollableEl = this.$el.parent().closestScrollable()[0];
- const style = window.getComputedStyle(this.el);
- this.el.style.setProperty('right', `${parseInt(style['right']) + scrollableEl.offsetWidth - scrollableEl.clientWidth}px`, 'important');
- } else {
- this.el.style.removeProperty('right');
- }
+ this._adaptFixedHeaderPosition();
this._adaptToHeaderChange();
},
/**
@@ -191,6 +196,7 @@ const BaseAnimatedHeader = animations.Animation.extend({
* @private
*/
_updateHeaderOnResize: function () {
+ this._adaptFixedHeaderPosition();
if (document.body.classList.contains('overflow-hidden')
&& config.device.size_class > config.device.SIZES.SM) {
document.body.classList.remove('overflow-hidden');