-
-
Save TheSavior/c8dcc7fa886ebf3a6d45 to your computer and use it in GitHub Desktop.
Wealthfront Blog Embed jQuery Deconstructed Example
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
var element = document.getElementsByClassName('selector')[0]; | |
var current = element.style.top; | |
var goal = 100; | |
var duration = 2; | |
var step = (goal - current) / (duration * 60); | |
var tick = function() { | |
current += step; | |
element.style.top = current + 'px'; | |
if (current < goal) { | |
setTimeout(tick, 1000/60); | |
} | |
} | |
tick(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment