From: Vincent Vanwaelscappel Date: Thu, 10 Jan 2019 17:24:38 +0000 (+0100) Subject: try #2502 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=035ae3477b136216e1a918a23a072d01402daa82;p=fluidbook-html5.git try #2502 @1.5 --- diff --git a/js/libs/fluidbook/fluidbook.pagetransitions.js b/js/libs/fluidbook/fluidbook.pagetransitions.js index 1064cccb..98745a43 100644 --- a/js/libs/fluidbook/fluidbook.pagetransitions.js +++ b/js/libs/fluidbook/fluidbook.pagetransitions.js @@ -65,6 +65,7 @@ FluidbookPageTransition.prototype = { } }, pageTransition3D: function (pageNr) { + console.log(this.transitionning); var $this = this; if ($("#pages").hasClass('_3dtransition')) { return; @@ -137,6 +138,7 @@ FluidbookPageTransition.prototype = { }, getTurningPages: function (newPage) { + var res = {}; res.dir = 1; if (newPage < this.fluidbook.currentPage) { @@ -146,7 +148,7 @@ FluidbookPageTransition.prototype = { if (this.fluidbook.l10n.dir === 'ltr') { res.currentLeft = this.fluidbook.currentPage - this.fluidbook.currentPage % 2; res.currentRight = res.currentLeft + 1; - if (res.dir == 1) { + if (res.dir === 1) { res.currentToClass = 'prev'; res.nextFromClass = 'next'; res.flat = [res.currentLeft, newPage + 1]; @@ -357,6 +359,7 @@ FluidbookPageTransition.prototype = { if ($("#currentDoublePage").length > 1) { $("#currentDoublePage:gt(0)").remove(); } + $("#nextDoublePage").remove(); this.transitionning = false; if (this.fluidbook.pad.enabled) { if (this.fluidbook.currentPage == this.fluidbook.datas.pages) { diff --git a/js/libs/fluidbook/fluidbook.support.js b/js/libs/fluidbook/fluidbook.support.js index a44c9c82..6a53075e 100644 --- a/js/libs/fluidbook/fluidbook.support.js +++ b/js/libs/fluidbook/fluidbook.support.js @@ -37,7 +37,7 @@ function FluidbookSupport(fluidbook) { this.androidbrowser = this.android && this.userAgent.search(/applewebkit/i) > -1; - this.transitionendevent = null; + this.transitionEndEvent = this.whichTransitionEvent(); if (window.resolution === 'auto') { if (Modernizr.mq('(min-device-width : 320px) and (max-device-width : 480px)')) { @@ -129,30 +129,24 @@ FluidbookSupport.prototype = { }, 100); } } + }, - // Test transition end event - var div = document.createElement('div'); - div.id = "my-transition-test"; - div.style.position = 'absolute'; - div.style.zIndex = -10; - div.style.bottom = '0px'; - div.style.height = '0px'; - div.style.width = '0px'; - div.style.background = 'yellow'; - //div.style.display = 'none'; - window.document.body.appendChild(div); - - $('#my-transition-test').one("webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd transitionEnd", function (e) { - if ($this.transitionEndEvent !== e.type) { - $this.transitionEndEvent = e.type; - } - window.document.body.removeChild(div); - }); + whichTransitionEvent: function () { + var t; + var el = document.createElement('fakeelement'); + var transitions = { + 'WebkitTransition': 'webkitTransitionEnd', + 'MozTransition': 'transitionend', + 'MSTransition': 'msTransitionEnd', + 'OTransition': 'oTransitionEnd', + 'transition': 'transitionEnd' + } - setTimeout(function () { - div.style[Modernizr.prefixed('transition')] = '0.1s'; - div.style[Modernizr.prefixed('transform')] = 'translate3d( 100px,0,0)'; - }, 25); + for (t in transitions) { + if (el.style[t] !== undefined) { + return transitions[t]; + } + } }, checkOrientation: function () { var o = this.getOrientation();