]> _ Git - fluidbook-html5.git/commitdiff
wait #5515 @3.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Oct 2022 16:29:32 +0000 (18:29 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Oct 2022 16:29:32 +0000 (18:29 +0200)
js/libs/fluidbook/fluidbook.links.js
style/fluidbook.less

index 5da91cc43ddd6b5ceb3858a27cddb60622d1b010..cf28e1c541722f615cf7f120f6d553d71930d6b7 100644 (file)
@@ -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);
         });
     },
 
index 85af377c9b94ab08c0ef9e0a80841f6004b9d761..1c240c4148fdd9be7f9d42b1e97d8aed43231687 100644 (file)
@@ -1469,6 +1469,13 @@ html.ios body.portrait #interface {
       visibility: visible;
       opacity: 1;
     }
+
+    &[data-animation-hide] {
+      transition: none;
+      &.show {
+        transition: none;
+      }
+    }
   }
 
   &[data-flipcard] {