Skip to content

Instantly share code, notes, and snippets.

@lbj96347
Created March 6, 2012 14:32
Show Gist options
  • Save lbj96347/1986564 to your computer and use it in GitHub Desktop.
Save lbj96347/1986564 to your computer and use it in GitHub Desktop.
Javascript ScrollUp Effect
function scrollUp(nowHeight,scrollHeight) {
//window scroll animation
function moveScroller(){
function outPut(arg){
window.scrollTo(0,arg);
}
for(var i = nowHeight; i <= scrollHeight; i++){
setTimeout((function(pos){
return function(){ outPut(pos); }
})(i), i * 2);
//})(-i), i * 2);
//the number 2 can be edited,it effects the speed of scrolling
//数字2可以修改,这会影响到你的滚动时候的速度
//the words aboves means you can edit the code and make the direction oppositly
//上面的语句修改,可以让你的滚动方向相反,具体需要你在项目实际过程中的需求
}
}
function _move(){
return function(){
moveScroller();
fadeEffect.init(spID,1);
}
}
window.setTimeout(_move(),500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment