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

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

為什么我的鼠標(biāo)點(diǎn)擊事件不能成功?


<script language="javascript">


window.onload=function(){

?var btn=document.getElementById('one');

?var timer=null;//創(chuàng)建定時(shí)器;

?var itop=true;

?

?//滾動(dòng)條滾動(dòng)時(shí)觸發(fā)事件

?window.onscroll=function(){

? if(!itop)

? {

? ? clearInterval(timer); ?//滾動(dòng)時(shí)如果點(diǎn)擊畫面,滾動(dòng)會(huì)停止;

? }

? itop=false;

?

?}

?

?btn.onclick=function(){

? ?

//設(shè)置定時(shí)器

timer=setInterval(function(){

? ?var top=document.documentElement.scrollTop||document.body.scrollTop;//獲取滾動(dòng)條距離頂部的數(shù)值,||解決兼容性問題;

//滾動(dòng)條依次往上滾動(dòng);

var ispeed=Math.floor(-top/6);//用數(shù)學(xué)函數(shù)將小數(shù)部分舍去;

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

? ?itop=true;

//如果回到頂部就關(guān)閉定時(shí)器

if(top==0)

{

clearInterval(timer);

}

},30);//滾動(dòng)時(shí)間

?}


}

</script>

<style type="text/css">

#content{

width:1000px;

height:5000px;

border:black 1px solid;

margin:auto;

}

#one{

?border:black 1px solid;

?background:url("123.jpg") no-repeat left top;

?width:40px;

?height:40px;

?position:fixed;

?left:50%;

?bottom:30px;

?margin-left:510px;

}

#one:hover{

?background:url("123.jpg") no-repeat left -40px;

}

</style>

</head>


<body>

<div id="content">


</div>

<a href="javascript:;" id="one" title="回到頂部"></a>

</body>

</html>


正在回答

2 回答

注意瀏覽器的兼容問題

0 回復(fù) 有任何疑惑可以回復(fù)我~
<!DOCTYPE?html>
<html>
<head>
<meta?charset="UTF-8">
<title>Document</title>
<script?language="javascript">

window.onload=function(){
var?btn=document.getElementById('one');
var?timer=null;//創(chuàng)建定時(shí)器;
var?itop=true;
?
//滾動(dòng)條滾動(dòng)時(shí)觸發(fā)事件
window.onscroll=function(){
?if(!itop)
?{
???clearInterval(timer);??//滾動(dòng)時(shí)如果點(diǎn)擊畫面,滾動(dòng)會(huì)停止;
?}
?itop=false;
?
}
?
btn.onclick=function(){
??
//設(shè)置定時(shí)器
timer=setInterval(function(){
??var?top=document.documentElement.scrollTop||document.body.scrollTop;//獲取滾動(dòng)條距離頂部的數(shù)值,||解決兼容性問題;
//滾動(dòng)條依次往上滾動(dòng);
var?ispeed=Math.floor(-top/6);//用數(shù)學(xué)函數(shù)將小數(shù)部分舍去;
document.documentElement.scrollTop=document.body.scrollTop=top+ispeed;
??itop=true;
//如果回到頂部就關(guān)閉定時(shí)器
if(top==0)
{
clearInterval(timer);
}
},30);//滾動(dòng)時(shí)間
}

}
</script>
<style?type="text/css">
#content{
width:1000px;
height:5000px;
border:black?1px?solid;
margin:auto;
}
#one{
border:black?1px?solid;
background:url("123.jpg")?no-repeat?left?top;
width:40px;
height:40px;
position:fixed;
left:50%;
bottom:30px;
margin-left:510px;
}
#one:hover{
background:url("123.jpg")?no-repeat?left?-40px;
}
</style>
</head>

<body>
<div?id="content">

</div>
<a?href="javascript:;"?id="one"?title="回到頂部"></a>
</body>
</html>

在谷歌下是可以的

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

舉報(bào)

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

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

進(jìn)入課程

為什么我的鼠標(biāo)點(diǎn)擊事件不能成功?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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