[FIX] website: restore parallax design

Commit https://github.com/odoo/odoo/commit/cf5b3e1db5d312133eb1af7ff0d5471db47987e5
fixed a problem by creating another one: the parallax with a given speed
appeared broken on page load (which is even more visible in 13.0 with
lazy loading).

This commit restores the design and solves the original problem.

closes odoo/odoo#41594

X-original-commit: a9aa72ecb5350cc0e9fa5b6a17d4db8d2f1895fd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2019-12-09 12:24:00 +00:00
parent 67da6d664f
commit 56f6d62324
2 changed files with 10 additions and 7 deletions
@@ -516,7 +516,6 @@ registry.parallax = Animation.extend({
destroy: function () {
this._super.apply(this, arguments);
$(window).off('.animation_parallax');
this.$target.css('overflow', '');
},
//--------------------------------------------------------------------------
@@ -544,18 +543,19 @@ registry.parallax = Animation.extend({
this.$bg.css('background-image', urlTarget);
}
this.$target.css('background-image', 'none');
this.$target.css('overflow', '');
// Get parallax speed
this.speed = parseFloat(this.$target.attr('data-scroll-background-ratio') || 0);
// Reset offset if parallax effect will not be performed and leave
this.$target.toggleClass('s_parallax_is_fixed', this.speed === 1);
if (this.speed === 0 || this.speed === 1) {
var noParallaxSpeed = (this.speed === 0 || this.speed === 1);
this.$target.toggleClass('s_parallax_no_overflow_hidden', noParallaxSpeed);
if (noParallaxSpeed) {
this.$bg.css({
transform: '',
top: '',
bottom: ''
bottom: '',
});
return;
}
@@ -571,9 +571,6 @@ registry.parallax = Animation.extend({
top: -this.ratio,
bottom: -this.ratio,
});
// TODO this introduces a limitation: no dropdown will be able to
// overflow. Maybe there is a better way to find.
this.$target.css('overflow', 'hidden');
},
//--------------------------------------------------------------------------
@@ -922,6 +922,12 @@ table.table_desc tr td {
.parallax {
position: relative;
// TODO this introduces a limitation: no dropdown will be able to
// overflow. Maybe there is a better way to find.
&:not(.s_parallax_no_overflow_hidden) {
overflow: hidden;
}
> * {
position: relative;
}