[FIX] website: fix animation in tabs and accordion blocks

Before this commit, animated elements did not animate in a tab that just
opened. Exact same problem was also happening with the accordion block.

Steps to reproduce the issue (with the tabs block) :

- Create a tabs block.
- Add some content with animation on each tab.
- Save.
- When you refresh, the first animation loads.
- Switch tab to another animation and wait - it won't load.
- Scroll up or down -> animation will show up.

opw-2813435

closes odoo/odoo#91850

X-original-commit: 2c21d5a7b493a3c88962ad9185391b6d6c7fc010
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Benjamin Vray
2022-05-23 11:59:59 +02:00
parent 2bcb6fd9d1
commit 4fb98f767a
@@ -1214,7 +1214,7 @@ registry.WebsiteAnimate = publicWidget.Widget.extend({
this.__onScrollWebsiteAnimate = _.throttle(this._onScrollWebsiteAnimate.bind(this), 200);
this.$scrollingElement[0].addEventListener('scroll', this.__onScrollWebsiteAnimate, {capture: true});
$(window).on('resize.o_animate, shown.bs.modal.o_animate, slid.bs.carousel.o_animate', () => {
$(window).on('resize.o_animate, shown.bs.modal.o_animate, slid.bs.carousel.o_animate, shown.bs.tab.o_animate, shown.bs.collapse.o_animate', () => {
this.windowsHeight = $(window).height();
this._scrollWebsiteAnimate(this.$scrollingElement[0]);
}).trigger("resize");