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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

為什么不能實(shí)現(xiàn)呢?

為什么不能實(shí)現(xiàn)呢?

筱羅卜 2016-09-17 17:52:39
按照視頻教的方法,我自己根據(jù)視頻里的代碼寫的,為什么回到頂部那張圖就是不能顯示?
查看完整描述

1 回答

?
Caballarii

TA貢獻(xiàn)1123條經(jīng)驗(yàn) 獲得超629個(gè)贊

代碼貼出來

查看完整回答
反對(duì) 回復(fù) 2016-09-17
  • 筱羅卜
    筱羅卜
    //index.htm <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Javascript回到頂部效果</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="script.js"></script> </head> <body> <div class="box"> <img src="image/pic1.gif" /> </div> <a href="javascript:;" id="btn" title="回到頂部"></a> </body> </html>
  • 筱羅卜
    筱羅卜
    //style.css /* CSS Document */ .box{ width:1200px; margin:0 auto; } .btn{ width:37px; height:38px; position:fixed; left:50%; margin:-left:630px; bottom:30px; background:url(image/btn.png) no-repeat left top;} #btn:hover{ background:url(image/btn.png) no-repeat left -38px; }
  • 筱羅卜
    筱羅卜
    //script.js // JavaScript Document //頁面加載完畢后觸發(fā) window.onload=function(){ var obtn=document.getElementById('btn'); var timer=null; var isTop=true; //滾動(dòng)條滾動(dòng)式觸發(fā) window.onscroll=funcyion(){ if(!isTop){ clearInterval(timer); } isTop=false; } obtn.onclick=function(){ //設(shè)置定時(shí)器 timer=setInterval(function(){ //獲取滾動(dòng)條距離頂部的高度 var osTop=document.documentElement.scrolTop || document.body.scrollTop; var ispeed=Math.floor(-osTop/5); isTop=true; document.documentElement.scrolTop = document.body.scrollTops = osTop + ispeed; console.log(osTop - ispeed); if(osTop==0){ clearInterval(timer); } },30); } }
點(diǎn)擊展開后面1
  • 1 回答
  • 0 關(guān)注
  • 891 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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