diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 8b6af7c3ad9..2641a9f5dd5 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -343,8 +343,7 @@ M.util.init_maximised_embed = function(Y, id) { }; var resize_object = function() { - obj.setStyle('width', '0px'); - obj.setStyle('height', '0px'); + obj.setStyle('display', 'none'); var newwidth = get_htmlelement_size('maincontent', 'width') - 35; if (newwidth > 500) { @@ -360,13 +359,16 @@ M.util.init_maximised_embed = function(Y, id) { newheight = 400; } obj.setStyle('height', newheight+'px'); + obj.setStyle('display', ''); }; resize_object(); // fix layout if window resized too - window.onresize = function() { - resize_object(); - }; + Y.use('event-resize', function (Y) { + Y.on("windowresize", function() { + resize_object(); + }); + }); }; /**