Created
April 4, 2020 08:45
-
-
Save condor-bird/7e63df3c4425541ef5a86f6e3a99537d to your computer and use it in GitHub Desktop.
Iframe auto height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// исходный документ | |
window.addEventListener('message', function (e) { | |
iframe.height = e.data; | |
}); | |
// загружаемый документ | |
window.addEventListener('load', function () { | |
parent.postMessage(document.documentElement.scrollHeight, '*'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment