第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

我這里哪里出錯(cuò)了,滾動(dòng)條動(dòng)不了呀,明明是照著老師的步驟一步一步來(lái)的

//頁(yè)面加載完觸發(fā)
window.onload=function () {
? ?var obtn = document.getElementById('btn');
? ?var timer=null;
? ?var ?istop=true;
? ? //滾動(dòng)條滾動(dòng)時(shí)出發(fā)
? ?window.onscroll=function () {
? ? ? ?if (!istop){
? ? ? ? ? ?clearInterval(timer);
? ? ? ?}
? ? ? ?istop=false;
? ?}

? ?obtn.onclick=function () {
? ? ? ?//設(shè)置定時(shí)器
? ? ? ?timer=setInterval(function () {
? ? ? ? ? ?//獲取滾動(dòng)條距離頂部的高度
? ? ? ?var ostop=document.documentElement.scrollTop || document.body.scrollTop;
? ? ? ? ? ?var ispeed=math.floor(-ostop/6);
? ? ? ?document.documentElement.scrollTop = document.body.scrollTop =ostop+ispeed;
? ? ? ? ? ?istop=true;

? ? ? ? ? ?console.log(ostop-ispeed);
? ? ? ? ? ?if (ostop==0){
? ? ? ? ? ? ? ?clearInterval(timer);
? ? ? ? ? ?}
? ? ? ?},30);
? ?}
}

正在回答

2 回答

document.documentElement.scrollTop = document.body.scrollTop =ostop+ispeed;

你這個(gè)連續(xù)賦值是不是有問(wèn)題

0 回復(fù) 有任何疑惑可以回復(fù)我~

你那個(gè)math.floor(),math應(yīng)該寫成Math.floor(),才可以

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
回到頂部效果
  • 參與學(xué)習(xí)       44202    人
  • 解答問(wèn)題       212    個(gè)

回到頂部網(wǎng)站不可缺少的一部分,用JS實(shí)現(xiàn)炫酷拉風(fēng)的回到頂部效果

進(jìn)入課程

我這里哪里出錯(cuò)了,滾動(dòng)條動(dòng)不了呀,明明是照著老師的步驟一步一步來(lái)的

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)