]> _ Git - fluidbook-html5.git/commitdiff
wait #3616 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Apr 2020 11:22:00 +0000 (13:22 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Apr 2020 11:22:00 +0000 (13:22 +0200)
js/libs/fluidbook/fluidbook.slideshow.js

index 982758379e0abaf6af4c884c48c8adddfc004cda..a838c44812e30695cbfaa324d7f00ad04e849be8 100644 (file)
@@ -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');
     }
 }