houssam_ballout Posted March 22, 2007 Share Posted March 22, 2007 Hello All,Please can u help me, I've this script it works fine, but what I need is that when the page reaches the end, I want to make it begin from the first and so on Thanks in advance This is the code:<script language="javascript">function pageScroll() { window.scrollBy(0,50); // horizontal and vertical scroll increments scrolldelay = setTimeout('pageScroll()',1000); // scrolls every 100 milliseconds}</script> Link to comment Share on other sites More sharing options...
iyeru42 Posted March 22, 2007 Share Posted March 22, 2007 To start at the beginning, the javaScript should be window.scroll(0,0), which will put the browser at x=0 and y=0 (top-left.) Link to comment Share on other sites More sharing options...
houssam_ballout Posted March 22, 2007 Author Share Posted March 22, 2007 To start at the beginning, the javaScript should be window.scroll(0,0), which will put the browser at x=0 and y=0 (top-left.)I know that, but I mean when the page is scrolling down, when it reaches the end I want to make it go back again.... Link to comment Share on other sites More sharing options...
iyeru42 Posted March 22, 2007 Share Posted March 22, 2007 Oh? And where in your javaScript says it's at the end? I have a pretty good idea. if(window.scroll = (this,this)) {// Do this.} But since everyone has a different reso, it'll be hard to make this script. Link to comment Share on other sites More sharing options...
jesh Posted March 22, 2007 Share Posted March 22, 2007 It might take a little bit of tweaking, but something like this may help: var body = document.body;if( (body.scrollHeight - body.clientHeight) <= body.scrollTop ){ // User is at the bottom of the page.} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now