diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-08-18 08:21:16 +0000 |
|---|---|---|
| committer | Xavier-Do <xdo@odoo.com> | 2020-08-27 17:07:33 +0000 |
| commit | 2d9667c2286354bf22c1cfea06c06a6b9250ba24 (patch) | |
| tree | f621ed0fe6998b44271a96f7d1667aef1d964387 /addons/website/static/src/js/utils.js | |
| parent | b6eb31511569551c0882b336bce46fdd44919e5c (diff) | |
[FIX] website: restore website menu loading with images
Since the images are now lazy loaded by default, the website menu was
not loaded correctly anymore when a mega menu was enabled and that there
was an image inside. Indeed, the menu loading waits for all images to
be loaded to compute the menu that should be in a dropdown when there
are too many. As the ones in the mega menus are hidden when the menu
is closed, the new lazy loading feature does not load them... which
makes the menu loading wait for something that is not being done.
This commit solves the problem by not waiting for images inside mega
menus. This could actually be done as a stable fix in stable versions
as there is no point waiting for those particular images in any case.
This will be only merged in master as it is not strictly a bug though,
at least for now.
Part of https://github.com/odoo/odoo/pull/56427
task-2264627
Diffstat (limited to 'addons/website/static/src/js/utils.js')
| -rw-r--r-- | addons/website/static/src/js/utils.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/website/static/src/js/utils.js b/addons/website/static/src/js/utils.js index 2544f4347fc..9a95f5aff21 100644 --- a/addons/website/static/src/js/utils.js +++ b/addons/website/static/src/js/utils.js @@ -96,10 +96,11 @@ function autocompleteWithPages(self, $input) { /** * @param {jQuery} $element + * @param {jQuery} [$excluded] */ -function onceAllImagesLoaded($element) { +function onceAllImagesLoaded($element, $excluded) { var defs = _.map($element.find('img').addBack('img'), function (img) { - if (img.complete) { + if (img.complete || $excluded && ($excluded.is(img) || $excluded.has(img).length)) { return; // Already loaded } var def = new Promise(function (resolve, reject) { |
