From 666fc3697bd7d70cfa0dd92f0a401b771196bb27 Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Fri, 5 Mar 2021 15:21:06 +0000 Subject: [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) --- addons/website/static/src/snippets/s_image_gallery/000.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/website/static/src') 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(); } -- cgit v1.2.3