From: Vincent Vanwaelscappel Date: Wed, 31 Aug 2022 11:57:11 +0000 (+0200) Subject: wait #5425 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=df75255dc387158e98a3ebb555ca6ba93e361281;p=fluidbook-html5.git wait #5425 @0.75 --- diff --git a/js/libs/fluidbook/fluidbook.support.js b/js/libs/fluidbook/fluidbook.support.js index 82b69950..496e9881 100644 --- a/js/libs/fluidbook/fluidbook.support.js +++ b/js/libs/fluidbook/fluidbook.support.js @@ -131,6 +131,9 @@ FluidbookSupport.prototype = { $(window).on('resize', function () { resize(); }); + setInterval(function () { + $this.checkOrientation(); + }, 1000); } else { if ("onorientationchange" in window) { window.addEventListener('orientationchange', function () { @@ -167,6 +170,7 @@ FluidbookSupport.prototype = { var o = this.getOrientation(); if (o != this._orientation) { this._orientation = o; + $(this.fluidbook).trigger('fluidbook.orientationchange'); resize(); } }, getOrientation: function () { diff --git a/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js b/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js index 920b073d..77fc807d 100644 --- a/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js +++ b/js/libs/fluidbook/slideshow/fluidbook.slideshow.dummy.js @@ -1,10 +1,36 @@ function FluidbookDummySlideshow(fluidbook) { this.fluidbook = fluidbook; - + this.intervalHandle = null; + this.timeoutHandle = null; + this.initEvents(); } FluidbookDummySlideshow.prototype = { - clear: function () { + + initEvents: function () { + var $this = this; + $(this.fluidbook).on('fluidbook.orientationchange', function () { + setTimeout(function () { + if ($this.fluidbook.support.getOrientation() === 90) { + $('.fb-slideshow-wrapper.dummy.fb-slideshow-inline .fb-slideshow').each(function () { + if ($(this).data('init') === true) { + $this.launchSlideshow($(this)); + } else { + $this.initSlideshow($(this)); + } + }); + } + }, 2000); + }); + }, + + clear: function (s) { + if ($(s).data('intervalHandle') !== undefined) { + clearRequestInterval($(s).data('intervalHandle')); + } + if ($(s).data('timeoutHandle') !== undefined) { + clearRequestTimeout($(s).data('timeoutHandle')); + } }, initSlideshow: function (s) { @@ -13,12 +39,20 @@ FluidbookDummySlideshow.prototype = { } 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)')); - requestInterval( + this.launchSlideshow($(s)); + }, + + launchSlideshow: function (s) { + this.clear(s); + var holder = $(s).find('.splide__list'); + var $this = this; + holder.find('.fb-slideshow-slide').removeClass('show'); + holder.find('.fb-slideshow-slide:eq(0)').addClass('show') + $(s).data('intervalHandle', requestInterval( function () { if (!$(holder).is(':visible')) { return; @@ -30,14 +64,15 @@ FluidbookDummySlideshow.prototype = { } $(next).css({display: 'block', zIndex: 2}); - requestTimeout(function () { + $(s).data('timeoutHandle', requestTimeout(function () { $(next).addClass('show').one($this.fluidbook.support.getTransitionEndEvent(), function () { $(holder).find('.fb-slideshow-slide.show').not(next).removeClass('show').css('display', 'none'); $(this).css({zIndex: '', display: ''}); }); - }, 200); + }, 200)); - }, parseFloat(this.fluidbook.settings.inlineSlideshowDuration) * 1000); + }, parseFloat($this.fluidbook.settings.inlineSlideshowDuration) * 1000) + ); }, resizeInline() {