Jump to content

HTML Constant Page Scroll Help

Go to solution Solved by Guest,

Ok i have seem to work it out with two different script. I do appreciate your help @Nineshadow. Your return to top script was at play so thanks again.

 

Page Auto Scrolling:

javascript:var isScrolling; var scrolldelay; function pageScroll() { window.scrollBy(0,1); scrolldelay = setTimeout('pageScroll()',100); isScrolling = true; } if(!isScrolling) { pageScroll(); } else { isScrolling = false; clearTimeout(scrolldelay); }

Return to top of page on refresh:
 

$(document).ready(function(){    $(this).scrollTop(0);});

Hi, 
I am looking for a script that i can put into my HTML page that will allow it to smoothly scroll to the bottom and when the page auto refreshed goes back to the top and starts again. 

I have no experience with JavaScript and have found no useful links online that worked.

 

Any help on this would be good. 

Thanks.

 

Link to comment
https://linustechtips.com/topic/389836-html-constant-page-scroll-help/
Share on other sites

Link to post
Share on other sites

You need JQuery.

In the script do this :

$(document).ready(function(){    $(this).scrollTop(0);});

This script resets the scrolling when you refresh.

 

This one makes an animation that scrolls to the bottom :

$(document).ready(function(){$('html, body').animate({scrollTop: $(document).height()}, 'slow');});

Then combine the two :

$(document).ready(function(){$(this).scrollTop(0);$('html, body').animate({scrollTop: $(document).height()}, 'slow');});

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

You need JQuery.

In the script do this :

$(document).ready(function(){    $(this).scrollTop(0);});

Nvm. I misread what you actually wanted.The script at the top just resets the scrolling when you refresh.

That's alright. Would you happen to know how to make the script to auto scroll with page reset on refresh?

Link to post
Share on other sites

That's alright. Would you happen to know how to make the script to auto scroll with page reset on refresh?

Check updated post.

 

Is that the effect you want?

Also, don't forget to include JQuery in your html file.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

That looks like it could be it. However, it scrolls way to fast how can i make it even slower?

Replace slow with smth like 5000 or whatever number works for you.

 

That's the animation time in miliseconds.Slow relates to 600ms.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

Replace slow with smth like 5000 or whatever number works for you.

 

That's the animation time in miliseconds.Slow relates to 600ms.

Hmmm doesn't seem to be accepting what ever value i put into it. Still scrolls really quick. I have even put some ridiculous time in to test.

Am i doing something wrong here?

 

$(document).ready(function(){$(this).scrollTop(0);$('html, body').animate({scrollTop: $(document).height()}, '5000000');});
Link to post
Share on other sites

Ok i have seem to work it out with two different script. I do appreciate your help @Nineshadow. Your return to top script was at play so thanks again.

 

Page Auto Scrolling:

javascript:var isScrolling; var scrolldelay; function pageScroll() { window.scrollBy(0,1); scrolldelay = setTimeout('pageScroll()',100); isScrolling = true; } if(!isScrolling) { pageScroll(); } else { isScrolling = false; clearTimeout(scrolldelay); }

Return to top of page on refresh:
 

$(document).ready(function(){    $(this).scrollTop(0);});
Link to post
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

×