Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Oakville
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can I scrollBy(100,0) to a target?

    Hi everybody.

    I was wondering if it is possible to use the scrollby(xx,xx); to scroll to a #target rather then a pre-set distance. Below is a scroll script I wrote. (its not the best, if the speed doesn't devide into the distance evenly it doesn't scroll to the right position)

    Hmmm. any ideas?

    thanks
    steven



    function scroller(distance,direction){
    var i=0
    var speed=10
    var pixels=speed
    if (direction=="back"){ pixels=pixels-(pixels*2) }
    while(i < (distance/speed)){
    scrollBy(pixels,0)
    i++
    }
    }

    <a href="javascript:scroller(800,'back')" >back</a>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What about scrollTo() ?

    scrollTo( parseInt( document.links['yourLink'].offsetLeft ), 0 );
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    See if this helps you out


    I created a script whereby you can allocate keywords to run a function that will scroll down or up the page to information relating to that keyword.

    To see the script see

    http://www.huntingground.freeserve.c...scrl_hlite.htm

    The main factor is how the target positions are located.

    No fixed positions have been used as the locations are found by using

    document.all[targetID].offsetTop


  •  

    Posting Permissions

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