cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

模仿demo3写了个例子,但是报错,请问原因。 #1124

Open xiaochuankk123 opened 7 years ago

xiaochuankk123 commented 7 years ago

Uncaught TypeError: Cannot read property

qq 20170114193235

'length' of undefined

Uncle-z commented 7 years ago

没有length属性,打断点在console里看一下元素都有什么属性

1003865572 commented 7 years ago

这个问的有点模糊

zhatongning commented 7 years ago

一般这种解决方式是,先判断length所属对象存在不,存在在用,不存在直接return