Javascript Help!!

Out of context: Reply #1

  • Started
  • Last post
  • 11 Responses
  • ilmarine0

    the example you provided only works when you have the stuff you want to scroll in predefined box (eg. in an iframe, like that site.) basically it takes the width of the iframe and multiplies it by something. the mupltiplier (eg. 2 or 3 - denoting the page) is past alog in the link.

    var mult = 480;
    var pos = 0;
    var speed = 40;

    function scr(targ)
    {
    xtarg = (targ*mult);
    while (pos!=xtarg)

    {
    pos = pos + speed;
    scrollTo(pos,0);
    }
    }

    var mult is the width of the iframe.
    var pos is the current position (leave it 0)
    var speed is the number of pixels, by which it scrolls.

    then every link (the arrow to another page) has a href like this >> Javascript:scr(1)
    where the number denotes the page.

    hope this explains.

    p.s. however, the script is faulty, because when you scroll it horsiontally to a point with you mouse and then press some arrow it scrolls itself til the end.

View thread