davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.

Home Page:https://iframe-resizer.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

initCallback is never called if iframe doesn't need to be resized yet

lostincomputer opened this issue · comments

initCallback is not called if the page doesn't need to be resized initially (isSizeChangeDetected returns false).

Here is a sample page to reproduce the issue with the default iframe-resizer settings

<body style="margin: 0; padding: 0">
<div id="content" style="height: 1px; background-color: red"></div>
<script>
$(function() {
   setTimeout(function() {
    $("#content").height(50);
   }, 1000);
});
</script>
</body>

My workaround right now is to use resizedCallback.

Have a try with the dev branch and let me know if that fixes things for you.

https://github.com/davidjbradshaw/iframe-resizer/tree/dev/src

Your'll need to uses the uncompressed version, or build the project with grunt.

It works. thanks!