From 59bb32fa44066efec0e33ab8feed569c2c78ff71 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 20 Apr 2015 15:37:49 +0200 Subject: [PATCH] Create a spaceholder when resizing iframes. --- js/h5p-resizer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/h5p-resizer.js b/js/h5p-resizer.js index 6318fc8..3d83db6 100644 --- a/js/h5p-resizer.js +++ b/js/h5p-resizer.js @@ -46,6 +46,11 @@ */ actionHandlers.prepareResize = function (iframe, data, respond) { responseData = {}; + + // Create spaceholder and insert after iframe. + var spaceholder = document.createElement('div'); + spaceholder.style.height = (iframe.clientHeight - 1) + 'px'; + iframe.parentNode.insertBefore(spaceholder, iframe.nextSibling); // Reset iframe height, in case content has shrinked. iframe.style.height = '1px'; @@ -64,6 +69,7 @@ actionHandlers.resize = function (iframe, data, respond) { // Resize iframe so all content is visible. iframe.style.height = data.height + 'px'; + iframe.nextSibling.remove(); }; /**