Skip to content

Instantly share code, notes, and snippets.

@wolmhp
Last active December 10, 2015 20:58
Show Gist options
  • Save wolmhp/4491712 to your computer and use it in GitHub Desktop.
Save wolmhp/4491712 to your computer and use it in GitHub Desktop.
JavaScript 动画基础. 25ms是最佳间隔.
(function(){
setTimeout(function(){
if (iLeft < 900) {
domEl.style['left'] = iLeft + 'px';
iLeft += iDelta;
iDelta = iDelta * 1;
setTimeout(arguments.callee, 25);
}
else {
domEl.style['left'] = '900px';
}
}, 25)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment