]> _ Git - fluidbook-html5.git/commitdiff
try #5017 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 12 Jan 2022 11:47:02 +0000 (12:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 12 Jan 2022 11:47:02 +0000 (12:47 +0100)
js/libs/fluidbook/fluidbook.articles.js

index a40f7db0e19ea9ee980f5791773cf7dadf2afce0..79847b560fc906eb72d339f590824994d42023a9 100644 (file)
@@ -86,18 +86,22 @@ FluidbookArticles.prototype = {
         $('iframe.pdfarticle.view').each(function () {
             var iframe = $(this);
             var view = iframe.parent().parent();
-            console.log(view,this);
+
             $(this).on('load', function () {
                 var body = $(this).contents().find('body');
-                var m=25;
+                var m = 25;
                 $(body).on('mousewheel', function (e) {
-                    var d=(e.deltaY*m);
-                    var v='-='+d;
-                    if(e.deltaY<0) {
-                        v='+='+(d*-1);
+                    var d = (e.deltaY * m);
+                    var v = '-=' + d;
+                    if (e.deltaY < 0) {
+                        v = '+=' + (d * -1);
                     }
                     $(view).scrollTo(v);
                 });
+                $this.initPDFArticles();
+                setTimeout(function () {
+                    $this.initPDFArticles();
+                }, 1000);
             });
         });
 
@@ -112,7 +116,7 @@ FluidbookArticles.prototype = {
 
         setTimeout(function () {
             $this.resize();
-        }, 10)
+        }, 10);
 
     },
 
@@ -135,9 +139,8 @@ FluidbookArticles.prototype = {
         return Object.keys(this.fluidbook.settings.articlesList).length > 0;
     },
 
-    resize: function () {
-        var $this = this;
-        $('iframe.pdfarticle').each(function () {
+    initPDFArticles: function () {
+        $('iframe.pdfarticle.view').each(function () {
             var body = $(this).contents().find('body');
             $(body).addClass('article');
             var $this = this;
@@ -147,6 +150,12 @@ FluidbookArticles.prototype = {
             }, 500);
 
         });
+    },
+
+    resize: function () {
+        var $this = this;
+        this.initPDFArticles();
+
         $(".mview article").each(function () {
             if ($(this).hasClass('pdf')) {