]> _ Git - fluidbook-html5.git/commitdiff
wip #5009 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Jan 2022 12:06:19 +0000 (13:06 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Jan 2022 12:06:19 +0000 (13:06 +0100)
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js
js/libs/fluidbook/slideshow/fluidbook.slideshow.js

index afb1cc6ad387f79e28a58188063823e32296f1ed..5ed6c9408f33f2b6cd338b77917111419d87be96 100644 (file)
@@ -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);
             });
index 9c279496f3678b3618ce1b70b7508129a8aef7aa..bc0b0d610f4f1aecf4cb47c3423fa54c45da98e9 100644 (file)
@@ -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() {
index eae4cb9113e92abc2c654b3fbe82800f40cd108e..ee2cad37397f84f21bf584338b748ae77d3d8f09 100644 (file)
@@ -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);