From: Vincent Vanwaelscappel Date: Fri, 21 Jan 2022 12:06:19 +0000 (+0100) Subject: wip #5009 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b94353624e5f7e4384d30fcfdd97139018c680f3;p=fluidbook-html5.git wip #5009 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index afb1cc6a..5ed6c940 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -932,9 +932,6 @@ FluidbookLinks.prototype = { var $this = this; if (this.fluidbook.slideshow !== undefined) { - if (this.fluidbook.slideshow) { - this.fluidbook.slideshow.clear(); - } $("#links .fb-slideshow, #currentDoublePage .fb-slideshow").each(function () { $this.fluidbook.slideshow.initInlineSlideshow(this); }); diff --git a/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js b/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js index 9c279496..bc0b0d61 100644 --- a/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js +++ b/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js @@ -5,39 +5,50 @@ function FluidbookDummySlideshow(fluidbook) { FluidbookDummySlideshow.prototype = { clear: function () { - $.each(this.intervals, function (k, v) { - clearInterval(v); - }); + // console.log('clear'); + // $.each(this.intervals, function (k, v) { + // clearInterval(v); + // }); }, initSlideshow: function (s) { if ($(s).data('init') === true) { return; } - var holder=$(s).find('.splide__list') + + var holder = $(s).find('.splide__list'); var $this = this; s.data('init', true); // Move first to end holder.append(holder.find('.fb-slideshow-slide:eq(0)')); - this.intervals.push(setInterval(function () { - var current = holder.find('.fb-slideshow-slide.show').eq(0); - var next = $(current).nextAll('.fb-slideshow-slide:not(.show):eq(0)'); - if ($(next).length === 0) { - next = holder.find('.fb-slideshow-slide:eq(0)'); - } + this.intervals.push( + setInterval( + function () { + if(!$(holder).is(':visible')){ + return; + } + var current = holder.find('.fb-slideshow-slide.show').eq(0); + var next = $(current).nextAll('.fb-slideshow-slide:not(.show):eq(0)'); + if ($(next).length === 0) { + next = holder.find('.fb-slideshow-slide:eq(0)'); + } + + $(next).css({display: 'block', zIndex: 2}); + + setTimeout(function () { + $(next).addClass('show').one($this.fluidbook.support.getTransitionEndEvent(), function () { + $(current).removeClass('show').css('display', 'none'); + $(this).css({zIndex: ''}); + }); + }, 200); - $(next).css({display: 'block', zIndex: 2}); + } + , parseFloat(this.fluidbook.settings.inlineSlideshowDuration) * 1000) + ); - setTimeout(function () { - $(next).addClass('show').one($this.fluidbook.support.getTransitionEndEvent(), function () { - $(current).removeClass('show').css('display', 'none'); - $(this).css({zIndex: ''}); - }); - }, 200); - }, parseFloat(this.fluidbook.settings.inlineSlideshowDuration) * 1000)); }, resizeInline() { diff --git a/js/libs/fluidbook/slideshow/fluidbook.slideshow.js b/js/libs/fluidbook/slideshow/fluidbook.slideshow.js index eae4cb91..ee2cad37 100644 --- a/js/libs/fluidbook/slideshow/fluidbook.slideshow.js +++ b/js/libs/fluidbook/slideshow/fluidbook.slideshow.js @@ -2,7 +2,6 @@ function FluidbookSlideshow(fluidbook) { this.fluidbook = fluidbook; this.instances = {}; - var $this = this; $.each(['popup', 'inline'], function (k, v) { @@ -57,16 +56,16 @@ FluidbookSlideshow.prototype = { }, initPopupSlideshow: function (s) { - var s = this.normalizeSlideshowElement(s); + s = this.normalizeSlideshowElement(s); this.popupInstance.initSlideshow(s); }, initInlineSlideshow: function (s) { - var s = this.normalizeSlideshowElement(s); + s = this.normalizeSlideshowElement(s); this.inlineInstance.initSlideshow(s); }, initSlideshow: function (s, context) { - var s = this.normalizeSlideshowElement(s); + s = this.normalizeSlideshowElement(s); if (context === 'popup') { this.initPopupSlideshow(s);