From cd34a06158914d81036f0b4677d9a3216756748c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 4 Oct 2019 15:50:05 +0200 Subject: [PATCH] fix #3110 @0.5 --- js/libs/fluidbook/fluidbook.slideshow.js | 61 ++++++++++++++---------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.slideshow.js b/js/libs/fluidbook/fluidbook.slideshow.js index e52fd25e..831e12b8 100644 --- a/js/libs/fluidbook/fluidbook.slideshow.js +++ b/js/libs/fluidbook/fluidbook.slideshow.js @@ -4,41 +4,50 @@ function FluidbookSlideshow(fluidbook) { FluidbookSlideshow.prototype = { initSlideshow: function (id) { - var $slideshow = $('#' + id), - thumbnailsID = id + '_thumbnails', - $thumbnails; + var $slideshow = $('#' + id); + var thumbnailsID = id + '_thumbnails'; + var $thumbnails; + var showThumbnails = $slideshow.data('thumbnails') == '1'; if ($slideshow.length == 0) return false; + // Dynamically add thumbnails from full sized images // Images have to load anyway so we can reuse full images for thumbnails - $('
').appendTo($slideshow.parent()); - $thumbnails = $('#' + thumbnailsID); + if (showThumbnails) { + $('
').appendTo($slideshow.parent()); + $thumbnails = $('#' + thumbnailsID); - $slideshow.find('img').each(function () { - var img = $(this).clone(); - $thumbnails.append(img); - }); + $slideshow.find('img').each(function () { + var img = $(this).clone(); + $thumbnails.append(img); + }); + } - // Main image slider - $slideshow.slick({ + var slideshowParams = { variableWidth: false, - asNavFor: '#' + thumbnailsID, // Synced with thumbnails slider - infinite: false, + infinite: true, draggable: true - }); + }; + if (showThumbnails) { + slideshowParams.asNasFor = '#' + thumbnailsID; // Synced with thumbnails slider + } + // Main image slider + $slideshow.slick(slideshowParams); - // Thumbnails slider - $thumbnails.slick({ - slidesToShow: 6, - asNavFor: '#' + id, // Synced with main slider - focusOnSelect: true, - variableWidth: true, - arrows: false, - draggable: true, - swipeToSlide: true, - infinite: false, - centerMode: false - }); + if (showThumbnails) { + // Thumbnails slider + $thumbnails.slick({ + slidesToShow: 6, + asNavFor: '#' + id, // Synced with main slider + focusOnSelect: true, + variableWidth: true, + arrows: false, + draggable: true, + swipeToSlide: true, + infinite: true, + centerMode: false + }); + } } } -- 2.39.5