- 博客(0)
- 资源 (1)
- 收藏
- 关注
animate.js
做了个动画的封装 但是在执行第一个清除定时器是一直报错
Uncaught TypeError: Cannot read property 'times' of null
一直报这个内容
function animate(obj,target){
clearInterval(obj.times);
obj.times = setInterval(function() {
var step = (target - obj.offsetLeft) / 10;
step = step > 0 ? Math.ceil(step) : Math.floor(step);
if(obj.offsetLeft == target){
clearInterval(obj.times);
}else{
obj.style.left = obj.offsetLeft + step + 'px' ;
}
},15);
}
2020-03-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅