Created
October 2, 2017 16:53
-
-
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.
This file contains 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
<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