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

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

用jquery做的,實(shí)現(xiàn)不了請(qǐng)老師看看哪里出問題

<!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"?xml:lang="en">
<head>
????<title>Javascript?回到頂部效果</title>
<style>
*{margin:0;padding:0;}
.box?{
????width:1190px;?????
?????margin:0?auto;
????}
????#btn?{
????width:40px;
????height:40px;
????position:?fixed;
????left:50%;?
????margin-left:610px;
????bottom:30px;?
????background:url(http://img1.sycdn.imooc.com//535e0dc100010e9c00400080.jpg)?no-repeat?left?top;
????}
???#btn:hover?{
????background:url(http://img1.sycdn.imooc.com//535e0dc100010e9c00400080.jpg)?no-repeat?0?-40px;
????}
?????

????</style>
</head>
<body>

<div>
<img?src="http://img1.sycdn.imooc.com//535e0ce800015b7511902787.jpg"?/>
</div>
<a?href="javascript:;"?id="btn"?title="回到頂部"></a>
<script?type="text/javascript"?src="jquery-1.7.2.min.js"></script>
<script>
????$(function(){
?????$("#btn").hide();
???var?top=document.documentElement.srcollTop?||?document.body.srcollTop;
???????if?(top>=100)?{$("#btn").show();}?else{$("#btn").hide();}
$("#btn").click(function(){
$("html,body").animate({scrollTop:0},300);
});
????})
</script>
</body>
</html>


正在回答

2 回答

$(window).scroll(function(){

? ? var top = $(window).scrollTop();


? ? if (top>=100) {

? ? ? ? $("#btn").show();

? ? } else{

? ? ? ? $("#btn").hide();

? ? }

? })


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

劉景照 提問者

非常感謝!
2014-12-11 回復(fù) 有任何疑惑可以回復(fù)我~

非常感謝如果換成下面

$(window).scroll(function(){

? ? var top = $(document).scrollTop();

document是什么意思文檔還是別的?


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

ITer在路上

就是文檔的意思啊
2015-10-10 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

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

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

進(jìn)入課程

用jquery做的,實(shí)現(xiàn)不了請(qǐng)老師看看哪里出問題

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

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

幫助反饋 APP下載

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

公眾號(hào)

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