]> _ Git - fluidbook-html5.git/commitdiff
fix #2503 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 15:09:10 +0000 (16:09 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 15:09:10 +0000 (16:09 +0100)
js/libs/fluidbook/fluidbook.menu.js

index 2995573a5e3b0d10f9e86fc7f93131ed964bd316..bc2b47cfe52fd62205ec6819989dd4af7d73766c 100644 (file)
@@ -178,6 +178,7 @@ FluidbookMenu.prototype = {
     },
 
     openIframe: function (iframe, callback) {
+        var $this = this;
         var a = $('a[href="#/iframe/' + iframe + '"]');
         var markup = decodeURIComponent($(a).attr('data-iframe'));
         var view = '<div class="caption">' + this.closeButton() + '</div>';
@@ -189,6 +190,13 @@ FluidbookMenu.prototype = {
         if (callback != undefined) {
             callback();
         }
+
+        var t = $("#view .iframeContainer").data('type');
+        $("#view").find('.iframeHolder,.content,.mview').attr('data-type', t);
+
+        $("#view .iframeContainer iframe").on('load', function () {
+            $this.resize();
+        });
     },
 
     openVideo: function (video, callback) {
@@ -617,6 +625,22 @@ FluidbookMenu.prototype = {
                     fullscreen = true;
                 }
                 forceHeight = true;
+
+                var iframe = $("#view .iframeHolder iframe");
+                iframe.css('width', w);
+                if (!fullscreen) {
+                    var ih = -1;
+                    try {
+                        ih = $(iframe).get(0).contentWindow.document.body.offsetHeight;
+                    } catch (e) {
+                        ih = -1;
+                    }
+
+                    if (ih > 0) {
+                        h = Math.min(ih, h);
+                    }
+                }
+
                 break;
             case 'cart':
                 w = 1024;