summaryrefslogtreecommitdiff
path: root/addons/website/static
diff options
context:
space:
mode:
authorYounn Olivier <yol@odoo.com>2021-03-05 15:21:06 +0000
committerYounn Olivier <yol@odoo.com>2021-03-05 15:23:59 +0000
commit666fc3697bd7d70cfa0dd92f0a401b771196bb27 (patch)
tree2c812ba5a1d4dbb1851b3453b4ba45c41940e07c /addons/website/static
parentc71f71fab63d2ccb1faeccbe54425f5b0fb488f0 (diff)
[FIX] website: fix image gallery slider index
The gallery slider index was wrongly calculated when the gallery had no active element, as the jquery method .index() will still return -1 when no element is found. task-2472041 closes odoo/odoo#67389 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static')
-rw-r--r--addons/website/static/src/snippets/s_image_gallery/000.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/website/static/src/snippets/s_image_gallery/000.js b/addons/website/static/src/snippets/s_image_gallery/000.js
index b86fbff652f..9bd0f8e39fd 100644
--- a/addons/website/static/src/snippets/s_image_gallery/000.js
+++ b/addons/website/static/src/snippets/s_image_gallery/000.js
@@ -124,7 +124,8 @@ const GallerySliderWidget = publicWidget.Widget.extend({
}
function update() {
- index = $lis.index($lis.filter('.active')) || 0;
+ const active = $lis.filter('.active');
+ index = active.length ? $lis.index(active) : 0;
page = Math.floor(index / realNbPerPage);
hide();
}