diff options
| author | qsm-odoo <qsm@odoo.com> | 2021-04-10 14:46:48 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2021-04-10 14:46:48 +0000 |
| commit | 21650ce342d0329c5385acf1181be154abbec550 (patch) | |
| tree | d2c5b97e90e317fb4782b090671217ce79e9c122 /addons/website/static/src | |
| parent | ba50228f0e19dae6da1e252380a948f46887890c (diff) | |
[FIX] website: restore scroll effects in custom code
The website scroll effects using the `AnimationEffect` Odoo API were not
working anymore if custom code enforces the html element as the
scrolling element. Indeed in that case the scroll event handlers were
now attached to the html element itself while it needs to be the window
in that case.
This may be something to fix at the source (the `getScrollingElement`
method). This will be checked later.
closes odoo/odoo#69083
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/content/snippets.animation.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index a08aa1d1014..58e5bfded6d 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -124,10 +124,12 @@ var AnimationEffect = Class.extend(mixins.ParentedMixin, { // Initialize the animation startEvents, startTarget, endEvents, endTarget and callbacks this._updateCallback = updateCallback; this.startEvents = startEvents || 'scroll'; - this.$startTarget = $($startTarget ? $startTarget : this.startEvents === 'scroll' ? $().getScrollingElement()[0] : window); + const mainScrollingElement = $().getScrollingElement()[0]; + const mainScrollingTarget = mainScrollingElement === document.documentElement ? window : mainScrollingElement; + this.$startTarget = $($startTarget ? $startTarget : this.startEvents === 'scroll' ? mainScrollingTarget : window); if (options.getStateCallback) { this._getStateCallback = options.getStateCallback; - } else if (this.startEvents === 'scroll' && this.$startTarget[0] === $().getScrollingElement()[0]) { + } else if (this.startEvents === 'scroll' && this.$startTarget[0] === mainScrollingTarget) { const $scrollable = this.$startTarget; this._getStateCallback = function () { return $scrollable.scrollTop(); |
