From: Vincent Vanwaelscappel Date: Fri, 7 Oct 2022 16:29:32 +0000 (+0200) Subject: wait #5515 @3.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d0728caadada6c7c17a6620fe3e1cf8c68692b40;p=fluidbook-html5.git wait #5515 @3.5 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 5da91cc4..cf28e1c5 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -15,6 +15,7 @@ function FluidbookLinks(fluidbook) { this.fluidbook = fluidbook; + this.lastTriggeredLinksPage = -1; try { this.zoom = new FluidbookLinksZoom(fluidbook); } catch (e) { @@ -65,20 +66,28 @@ FluidbookLinks.prototype = { this.lowdef = this.fluidbook.support.android || this.fluidbook.support.iOS; + $(this.fluidbook).on('fluidbook.page.change.end', function () { + if ($this.lastTriggeredLinksPage == $this.fluidbook.currentPage) { + return; + } + $this.lastTriggeredLinksPage = $this.fluidbook.currentPage; var pages = $this.fluidbook.getDisplayedPages(); var links = []; $.each(pages, function (k, page) { $.each($this.fluidbook.settings.triggersLinks, function (j, triggers) { if (triggers.page == page && links.indexOf(triggers.link) === -1) { - links.push(triggers.link); + links.push({link: triggers.link, delay: triggers.delay}); } }); }); $.each(links, function (k, link) { - $this.triggerLinkById(link); + console.log + setTimeout(function () { + $this.triggerLinkById(link.link); + }, link.delay * 1000); }); }); @@ -217,8 +226,8 @@ FluidbookLinks.prototype = { }); $(document).on(this.fluidbook.input.clickEvent, '[data-showid]:not([data-showmode="showonhover"])', function () { - var mode = $(this).data('showmode'); + var mode = $(this).data('showmode'); var ids = $(this).data('showid').toString().split(','); if (mode === 'hide') { @@ -278,7 +287,11 @@ FluidbookLinks.prototype = { selector += ':not([data-id$="' + id + '"])'; }); $(selector).each(function () { - $this.hidePlacedLink(this, (mode === 'shownext' || mode === 'shownextcycle') ? 500 : 0); + var timeout = (mode === 'shownext' || mode === 'shownextcycle') ? 500 : 0; + if ($(selector).is('[data-animation-hide]')) { + timeout = 0; + } + $this.hidePlacedLink(this, timeout); }); } @@ -301,13 +314,15 @@ FluidbookLinks.prototype = { }); }, 10); - $(l).trigger('fluidbook.link.show'); if (close !== 'none') { $(l).removeClass('notinteractive'); $(l).find('img').css('pointer-events', 'none'); } setTimeout(function () { + if ($(l).is('[data-animation-hide]') && !$(l).hasClass('show')) { + $this.animateContentLink($(l), true, true, 0); + } $(l).addClass('show'); }, 10); }); @@ -604,8 +619,12 @@ FluidbookLinks.prototype = { }); }, - animateContentLink: function (link, autostart) { - if ($(link).data('animation-started') === true) { + animateContentLink: function (link, autostart, force, delay) { + + if (force === undefined) { + force = false; + } + if (!force && $(link).data('animation-started') === true) { return; } if (autostart === undefined) { @@ -639,9 +658,13 @@ FluidbookLinks.prototype = { } }); + var override = {}; + if (delay !== undefined) { + override.delay = delay; + } $.each(animations, function (k, animation) { - $this.executeAnimation(link, $.extend({}, firstDefaults, animation), autoStartThisAnim); + $this.executeAnimation(link, $.extend({}, firstDefaults, animation, override), autoStartThisAnim); }); }, diff --git a/style/fluidbook.less b/style/fluidbook.less index 85af377c..1c240c41 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -1469,6 +1469,13 @@ html.ios body.portrait #interface { visibility: visible; opacity: 1; } + + &[data-animation-hide] { + transition: none; + &.show { + transition: none; + } + } } &[data-flipcard] {