js動(dòng)態(tài)移動(dòng)滾動(dòng)條至底部示例代碼
更新時(shí)間:2014年04月24日 17:44:24 作者:
這篇文章主要介紹了使用js動(dòng)態(tài)移動(dòng)滾動(dòng)條至底部,需要的朋友可以參考下
復(fù)制代碼 代碼如下:
var currentPosition,timer;
function GoBottom(){
timer=setInterval("runToBottom()",50);
}
function runToBottom(){
currentPosition=document.documentElement.scrollTop || document.body.scrollTop;
currentPosition+=30;
if(currentPosition<document.body.scrollHeight && (document.body.clientHeight + document.body.scrollTop < document.body.scrollHeight))
{
//window.scrollTo(0,currentPosition);
//alert(document.documentElement.clientHeight + " " + document.documentElement.scrollTop + " " + document.documentElement.scrollHeight + "#" +document.body.clientHeight + " " + document.body.scrollTop + " " + document.body.scrollHeight);
document.body.scrollTop = currentPosition;
}
else
{
document.body.scrollTop = document.body.scrollHeight;
clearInterval(timer);
}
}
您可能感興趣的文章:
- js判斷客戶端是iOS還是Android等移動(dòng)終端的方法
- JS onmousemove鼠標(biāo)移動(dòng)坐標(biāo)接龍DIV效果實(shí)例
- js 鼠標(biāo)移動(dòng)顯示圖片的簡單實(shí)例
- js如何判斷用戶是在PC端和還是移動(dòng)端訪問
- javascript移動(dòng)設(shè)備Web開發(fā)中對(duì)touch事件的封裝實(shí)例
- js實(shí)現(xiàn)鍵盤控制DIV移動(dòng)的方法
- 原生js實(shí)現(xiàn)移動(dòng)開發(fā)輪播圖、相冊(cè)滑動(dòng)特效
- js實(shí)現(xiàn)touch移動(dòng)觸屏滑動(dòng)事件
- JavaScript代碼實(shí)現(xiàn)左右上下自動(dòng)晃動(dòng)自動(dòng)移動(dòng)
相關(guān)文章
javascript break指定標(biāo)簽打破多層循環(huán)示例
break的語法有兩種break; 和 break label;下面為大家介紹下直接break掉整個(gè)循環(huán)嵌套示例2014-01-01
js用于樹型結(jié)構(gòu)級(jí)聯(lián)選擇
js用于樹型結(jié)構(gòu)級(jí)聯(lián)選擇...2007-01-01
Openlayers實(shí)現(xiàn)地圖的基本操作
這篇文章主要為大家詳細(xì)介紹了Openlayers實(shí)現(xiàn)地圖的基本操作,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-09-09
js獲取json中key所對(duì)應(yīng)的value值的簡單方法
下面小編就為大家?guī)硪黄猨s獲取json中key所對(duì)應(yīng)的value值的簡單方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-03-03

