Skip to content

Instantly share code, notes, and snippets.

@nleush
Created October 2, 2017 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nleush/9d960c17eea0fee51511ab8f79319db3 to your computer and use it in GitHub Desktop.
Save nleush/9d960c17eea0fee51511ab8f79319db3 to your computer and use it in GitHub Desktop.
Example of using iframely.events.on('heightChanged') event with dynamic embed.js script loading.
<script>
var iframely = window.iframely = window.iframely || {};
var widgets = iframely.widgets = iframely.widgets || {};
function iframelyLoaded() {
iframely.events.on('heightChanged', function(iframe, oldHeight, newHeight) {
// your handler here, like
// adjustScroll(newHeight - oldHeight);
// iframe is a dom element, heights are numbers
});
}
if (widgets.load) {
iframelyLoaded();
} else {
widgets._e = widgets._e || [];
widgets._e.push(iframelyLoaded);
}
</script>
<script async src="//cdn.iframe.ly/embed.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment