Jump to content

javascript help in scroll down and up


houssam_ballout

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...