Created
September 23, 2019 18:04
-
-
Save ryanzhou7/ba5d67827bd53d918c665bd781bf0712 to your computer and use it in GitHub Desktop.
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> | |
window.iFrameResizer = { | |
// Allows messages from anywhere | |
targetOrigin: '*', | |
// Receiving a message from the parent | |
onMessage: function(message) { | |
var messageData = JSON.parse(message); | |
// Check that this message is for this iframe | |
if( messageData["id"] === iframeId ){ | |
var sr = messageData["scrollRatio"]; | |
var vr = messageData["verticalDisplayRatio"]; | |
// Trigger animation | |
if( sr > 0.5 || vr > 0.5 ){ | |
animate(); | |
} | |
// animateProgressBar(sr); | |
} | |
}, | |
} | |
function animate(){ | |
// do entire animation | |
} | |
function animateProgressBar(percentageComplete){ | |
// move from current position to percentageComplete | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment