Welcome visitor
* Login
* Register
It is currently January 22nd, 2019, 6:20 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  automatic scroll and faster scrolling with JavaScript
PostPosted: December 23rd, 2009, 6:35 pm 
User avatar

Posts: 34
Hey,

I have automatic scroll on my site using javascript, so when the page is loaded it starts to scroll down. Can you help me to create 2 buttons (up & down) and when a button is clicked the page should scroll faster?

I don't know to much javascript so thank you for your help.

this is the topic from where I got the javascript automatic scroll down code.
http://www.scriptingok.com/forum/t12_167-Automatic-scroll-down


Top
 Profile  
 
  Re: automatic scroll and faster scrolling with JavaScript
PostPosted: December 23rd, 2009, 7:29 pm 
User avatar

Posts: 136
JavaScript
<script type="text/javascript">
a=0;
u=0;
d=0;
function scroll()
{
if(a!=0){return false;}
  py=80;
  window.scrollBy(0,py);
  delay = setTimeout('scroll()',800);
}
function scrollu()
{
if(u!=0){return false;}
  py=-80;
  window.scrollBy(0,py);
  delay = setTimeout('scrollu()',000);
}
function scrolld()
{
if(d!=0){return false;}
  py=80;
  window.scrollBy(0,py);
  delay = setTimeout('scrolld()',200);
}
</script>
HTML
<body onload="u=1; d=1; scroll();">
<div id="bheader">
  <input type="button" value="up" onmouseover="a=1; d=1; u=0; scrollu();"
    onmouseout="u=1; a=0; scroll();" />
  <input type="button" value="down" onmouseover="a=1; u=1; d=0; scrolld();"
    onmouseout="d=1; a=0; scroll();" />
</div>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron