]> _ Git - fluidbook-html5.git/commitdiff
try #2502 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 17:24:38 +0000 (18:24 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 17:24:38 +0000 (18:24 +0100)
js/libs/fluidbook/fluidbook.pagetransitions.js
js/libs/fluidbook/fluidbook.support.js

index 1064cccbcfbd3fa7998f89cc9dbbafb58142fb40..98745a43443b84f9867312fa51580b753ece7e6a 100644 (file)
@@ -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) {
index a44c9c8213f111c64e9b453454930e3f1eeb797b..6a53075e500813eba68381208ab4fd2dc157f6c2 100644 (file)
@@ -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();