Fixed iframe solution in IE8.

namespaces
Frode Petterson 2013-10-28 14:08:59 +01:00
parent 2720ec5f16
commit 44b5d89970
2 changed files with 12 additions and 8 deletions

View File

@ -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);
}
};

View File

@ -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 ';