From 44b5d8997020f3e17fc363834a4af4f57b30f377 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 28 Oct 2013 14:08:59 +0100 Subject: [PATCH] Fixed iframe solution in IE8. --- js/h5p.js | 15 ++++++++------- styles/h5p.css | 5 ++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index d8b040f..75e42ee 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1,7 +1,7 @@ var H5P = H5P || {}; // This needs to be determined before init is run. -H5P.isFramed = (window.parent !== window); +H5P.isFramed = (window.self !== window.top); // (window.parent !== window); // Initialize H5P content // Scans for ".h5p-content" @@ -80,18 +80,19 @@ H5P.init = function () { // Add scripts required for this iFrame from settings H5PIntegration.addFilesToIframe($iframe, contentId); }); - if ($h5pIframes.length > 0) { + if ($h5pIframes.length !== 0) { // TODO: This seems very hacky... why can't we just use the resize event? What happens if we ain't done before the next interval starts? - setInterval(function h5pIframeResizer() { + setInterval(function () { $h5pIframes.each(function (idx, iframe) { - var contentHeight = iframe.contentDocument.body.offsetHeight; - var frameHeight = H5P.jQuery(iframe).innerHeight(); + var $iframe = H5P.jQuery(iframe); + var contentHeight = $iframe.contents().height(); + var frameHeight = $iframe.innerHeight(); if (frameHeight !== contentHeight) { - H5P.resizeIframe(H5P.jQuery(iframe).data('content-id'), contentHeight); + H5P.resizeIframe($iframe.data('content-id'), contentHeight); } }); - }, 100); + }, 250); } }; diff --git a/styles/h5p.css b/styles/h5p.css index 8330945..96d7b41 100644 --- a/styles/h5p.css +++ b/styles/h5p.css @@ -60,7 +60,8 @@ div.h5p-semi-fullscreen { height: 100%; } .h5p-iframe-wrapper { - width: auto; height: auto; + width: auto; + height: auto; } .h5p-fullscreen .h5p-iframe-wrapper, @@ -91,6 +92,8 @@ div.h5p-semi-fullscreen { width: 100%; height: 100%; z-index: 10; + overflow: hidden; + border: 0; } .h5p-iframe-wrapper.h5p-semi-fullscreen .buttons button:before { content: 'Exit ';