From 9fc34100df02e09415e6aa5dd996cc6bb37d9e36 Mon Sep 17 00:00:00 2001 From: nobuti Date: Thu, 12 Jan 2017 05:59:31 +0100 Subject: [PATCH] Wait until load to bind the resize handler. --- src/js/plugin/resizer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/plugin/resizer.js b/src/js/plugin/resizer.js index 9f5555d..8e87185 100644 --- a/src/js/plugin/resizer.js +++ b/src/js/plugin/resizer.js @@ -16,7 +16,9 @@ module.exports = function (element) { var frame = document.createElement('iframe'); frame.style.cssText = CSS; element.appendChild(frame); - i.event.bind(frame.contentWindow, 'resize', handler); + frame.onload = function () { + i.event.bind(frame.contentWindow, 'resize', handler); + }; return frame; };