欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript簡(jiǎn)單實(shí)現(xiàn)跟隨滾動(dòng)條漂浮的返回頂部按鈕效果

 更新時(shí)間:2016年08月19日 11:36:01   作者:微wx笑  
這篇文章主要介紹了javascript簡(jiǎn)單實(shí)現(xiàn)跟隨滾動(dòng)條漂浮的返回頂部按鈕效果,涉及javascript基于onscroll事件動(dòng)態(tài)改變頁(yè)面元素樣式的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了javascript簡(jiǎn)單實(shí)現(xiàn)跟隨滾動(dòng)條漂浮的返回頂部按鈕效果。分享給大家供大家參考,具體如下:

比較優(yōu)秀的一款超過(guò)一屏高度才顯示的,跟隨滾動(dòng)條漂浮的返回頂部按鈕特效代碼。

運(yùn)行效果如下圖所示:

完整實(shí)例代碼如下:

<!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=utf-8" />
<title>test</title>
<style>
body{ height:2000px;}
.rTop{ width:100px; height:25px; text-align:center; font-size:small; line-height:25px; border:1px solid #999; position:fixed; right:0; bottom:0;
border-bottom-color:#333; border-right-color:#333; margin:5px; cursor:pointer; display:none}
</style>
</head>
<body>
<div class="rTop" id="rTop">返回頂部</div>
<script>
 window.onscroll=function(){
 if(document.body.scrollTop||document.documentElement.scrollTop>0){
 document.getElementById('rTop').style.display="block"
 }else{
 document.getElementById('rTop').style.display="none"
 }
 }
</script>
</body>
</html>

更多關(guān)于JavaScript相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《JavaScript切換特效與技巧總結(jié)》、《JavaScript查找算法技巧總結(jié)》、《JavaScript動(dòng)畫(huà)特效與技巧匯總》、《JavaScript錯(cuò)誤與調(diào)試技巧總結(jié)》、《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)》、《JavaScript遍歷算法與技巧總結(jié)》及《JavaScript數(shù)學(xué)運(yùn)算用法總結(jié)

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論