SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: scrolling text

  1. #1
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    scrolling text

    Here is a little script I made and it just vertically scrolls text, but this is about the slowest I can make the text scroll, how could I get it to scroll slower witht his script? I can't increase the timeout else the eye can detect it.
    HTML Code:
    <script type='text/javascript'>
    var done = false;
    function scrollUp(x) 
    {
    	var box = document.getElementById('inner-scroll-box');
    	if (Math.abs(x) > box.scrollHeight) done = true;
    	box.style.top = (x - 1) + 'px';
    
    	if (!done) {
    		setTimeout('scrollUp(' + parseInt(box.style.top) + ')', 25);	
    	} else {
    		done = false;
    		scrollUp(100);	
    	}
    }
    </script>
    

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It looks like it sets the .style.top property to 99, then 98, then 97 etc - so this can't really be changed to go slower as 1 pixel at a time is the minimum.

    So your option is to change the timeout delay


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •