Created
March 6, 2012 14:32
-
-
Save lbj96347/1986564 to your computer and use it in GitHub Desktop.
Javascript ScrollUp Effect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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