多次滚动会出现bug,怎么解决
Uncaught TypeError: Cannot read property 'shift' of null这个报错什么原因呢
这效果不错,滚条重新进入后又会重新调用动画,不像其它的非要刷新页面
var f = function() {
if ($this.data('counterup-nums')) {
$this.text($this.data('counterup-nums').shift());
if ($this.data('counterup-nums').length) {
setTimeout($this.data('counterup-func'), delay);
} else {
delete $this.data('counterup-nums');
$this.data('counterup-nums', null);
$this.data('counterup-func', null);
}
}
};就是最外层给个大的判断