SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setTimeout faster

    hi
    how do i make this function go faster?
    its a sliding menu but it comes accross the screen too slow, refreshing the function every second.

    heres a bit of the code ...if i change the setTimeout to 100 it just goes slower ... how do i get milliseconds?

    <script language="JavaScript" type="text/javascript">
    <!--


    inc = -100
    pos = 20
    function move(){
    if(document.getElementById('test').style.pixelLeft<=pos){
    document.getElementById('test').style.display='block'
    document.getElementById('test').style.pixelLeft=inc++;
    setTimeout("move()",1)
    }
    }
    //-->
    </script>

    cheers chris

  2. #2
    SitePoint Zealot Arkkimaagi's Avatar
    Join Date
    Mar 2002
    Location
    Lappeenranta, Finland
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Timeout uses milliseconds.. ..currently you are using one millisecond. This will show up in slower computers slower because their browser can not render the thing that fast. I'd increase the timeout somewhat and then use bigger gaps to move. You can move 10px or 50px at a time..


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
  •