From 9d9db567cee12b90bcff99cdb4b5ae5f4fdc39a6 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 16 May 2019 19:38:20 +0200 Subject: [PATCH] wait #2718 @3 --- js/libs/fluidbook/fluidbook.links.js | 48 ++++++++++++++-------- js/libs/fluidbook/fluidbook.mobilefirst.js | 31 +++++++++++++- style/mobilefirst.less | 11 +++++ 3 files changed, 71 insertions(+), 19 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 89c1ee03..891deee7 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -434,24 +434,11 @@ FluidbookLinks.prototype = { var $this = this; var links = $(container).find(".link a.displayArea"); - $(links).each(function () { - var delay = $(this).data('blinkdelay'); - if (delay === undefined || delay === null) { - delay = 0; - } else { - delay = parseInt(delay); - } - var e = this; - - setTimeout(function () { - $(e).addClass('animating').css('opacity', 1); - TweenMax.to(e, $this.fluidbook.datas.linkBlinkTime, { - opacity: 0, delay: .1, onComplete: function () { - $(e).removeClass('animating').css('opacity', 1) - } - }); - }, delay + additionalDelay); - }); + if (!this.fluidbook.mobilefirst.enabled) { + $(links).each(function () { + $this.animateLink(this, additionalDelay); + }); + } if (animateBookmarks) { @@ -465,6 +452,31 @@ FluidbookLinks.prototype = { } }, + animateLink: function (link, additionalDelay) { + var $this = this; + if (!$(link).is('.displayArea')) { + link = $(link).find('.displayArea'); + } + if (additionalDelay === undefined) { + additionalDelay = 0; + } + var delay = $(link).data('blinkdelay'); + if (delay === undefined || delay === null) { + delay = 0; + } else { + delay = parseInt(delay); + } + + setTimeout(function () { + $(link).addClass('animating').css('opacity', 1); + TweenMax.to(link, $this.fluidbook.datas.linkBlinkTime, { + opacity: 0, delay: .1, onComplete: function () { + $(link).removeClass('animating').css('opacity', 1) + } + }); + }, delay + additionalDelay); + }, + zoomLink: function (link) { var $this = this, diff --git a/js/libs/fluidbook/fluidbook.mobilefirst.js b/js/libs/fluidbook/fluidbook.mobilefirst.js index d2d82c1c..21f9ed91 100644 --- a/js/libs/fluidbook/fluidbook.mobilefirst.js +++ b/js/libs/fluidbook/fluidbook.mobilefirst.js @@ -27,10 +27,19 @@ FluidbookMobileFirst.prototype = { $("#pages .mf-nav").removeClass('hiddenzoom'); }); + $(this.fluidbook).on('fluidbook.page.change.end', function () { + $this.checkScroll(); + }); + this.fluidbook.datas.soundTheme = ''; }, - checkScroll: function (top) { + checkScroll: function () { + this.checkFooterNavReveal(); + this.checkLinksReveal(); + }, + + checkFooterNavReveal: function () { if (!this.fluidbook.pagetransitions.canChangePage()) { return; } @@ -42,6 +51,26 @@ FluidbookMobileFirst.prototype = { } }, + checkLinksReveal: function () { + var $this = this; + $("#links .link:not(.revealed):visible").each(function () { + var rect = $(this).get(0).getBoundingClientRect(); + if (rect.top < $this.fluidbook.resize.hh) { + $(this).addClass('revealed'); + if ($(this).find('a.displayArea').length > 0) { + $this.fluidbook.links.animateLink(this, 800); + } else if ($(this).is('.multimedia.notinteractive')) { + var url = $(this).find('iframe').attr('src'); + var iframe = $(this).find('iframe'); + iframe.attr('src', null); + setTimeout(function () { + $(iframe).attr('src', url); + }, 10); + } + } + }); + }, + beforeTransition: function (page) { $('#pages .mf-nav').css({opacity: 0}); var $this = this; diff --git a/style/mobilefirst.less b/style/mobilefirst.less index 3ee9f4e0..da648f98 100644 --- a/style/mobilefirst.less +++ b/style/mobilefirst.less @@ -70,6 +70,16 @@ } } } + + .link.multimedia.notinteractive { + visibility: hidden; + opacity: 0; + + &.revealed { + visibility: visible; + opacity: 1; + } + } } .mview.fs .fonctions { @@ -155,6 +165,7 @@ .pageholder { height: 100%; + &.cut { overflow: hidden; position: relative; -- 2.39.5