From 673196b57ea331105e9d1cc2a1d7f62a2be83b6a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 23 Apr 2020 13:22:00 +0200 Subject: [PATCH] wait #3616 @2 --- js/libs/fluidbook/fluidbook.slideshow.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.slideshow.js b/js/libs/fluidbook/fluidbook.slideshow.js index 98275837..a838c448 100644 --- a/js/libs/fluidbook/fluidbook.slideshow.js +++ b/js/libs/fluidbook/fluidbook.slideshow.js @@ -4,10 +4,11 @@ function FluidbookSlideshow(fluidbook) { FluidbookSlideshow.prototype = { initSlideshow: function (id) { + var $this=this; var $slideshow = $('#' + id); var thumbnailsID = id + '_thumbnails'; var $thumbnails; - var showThumbnails = $slideshow.data('thumbnails') == '1'; + var showThumbnails = $slideshow.attr('data-thumbnails') === '1'; if ($slideshow.length == 0) return false; @@ -55,8 +56,20 @@ FluidbookSlideshow.prototype = { draggable: true, swipeToSlide: true, infinite: true, - centerMode: false + centerMode: false, }); + + $slideshow.on('afterChange', function () { + $this.afterChange(id); + }); + this.afterChange(id); } + }, + + afterChange: function (id) { + var thumbnailsID = id + '_thumbnails'; + var inFocus = $('#' + id + ' .slick-current').attr('data-slick-index'); + $('#' + thumbnailsID + ' .slick-current').removeClass('slick-current'); + $('#' + thumbnailsID + ' .slick-slide[data-slick-index="' + inFocus + '"]').trigger('click'); } } -- 2.39.5