为了账号安全,请及时绑定邮箱和手机立即绑定

当speed=7时,这个函数怎么样都不会经过0吧

当speed=7时,这个函数怎么样都不会经过0吧

喵喔喔 2019-02-06 15:57:37
function srcoll(index,timer,speed) {    var number=document.body.scrollTop-(lin_setFullHeight()*(index-1))    console.log('number',number)    if(number>0){        document.body.scrollTop-=speed        window.requestAnimationFrame(function () {            srcoll(index,timer,speed)        });    }    if(number==0){        console.log("stop scrollling")        window.cancelAnimationFrame(timer)    }    if(number<0){        document.body.scrollTop+=speed        window.requestAnimationFrame(function () {            srcoll(index,timer,speed)        });    }}因为950-7-7这样减下去怎么样都不会等于0吧 为什么还是停下来了那个lin_setFullHeight()是950
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 275 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号