function animate(obj, target, callback) {
clearInterval(obj.timer);
obj.timer = setInterval(function () {
if (obj.offsetLeft == target) {
clearInterval(obj.timer);
}
var step = (target - obj.offsetLeft) / 10;
step = step > 0 ? Math.ceil((step) / 10) : Math.floor((step) / 10);
obj.style.left = obj.offsetLeft + step + 'px';
callback && callback();
// }
}, 5);
}
最后
以上就是酷炫紫菜最近收集整理的关于动画函数(很重要)的全部内容,更多相关动画函数(很重要)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复