coffeescript写的一个无限下拉小程序

时间:2018-08-08 14:51:52   收藏:0   阅读:200
locate=$(document).height()-$(window).height()
times=0
scroller = (cb)->
  if locate<=$(document).height()-$(window).height()
    times=0
    locate+=100
    scroll(0,locate)
    clearTimeout(timer)
    timer=setTimeout("scroller()",54)
    timer
  else
    await sleep 3000, defer()
    times++
    console.log times
    return if times>3
    scroller()
scroller()

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!