jquery waypoints

Out of context: Reply #8

  • Started
  • Last post
  • 16 Responses
  • monNom0

    ^ this what you're looking for

    To expand on my earlier post, you'll need a cursor variable to hold the current target index, an array of elements representing the HTML elements you want to scroll too, and something like jquery to take care of the scroll animation..

    //pseudocode:

    cursor = 0;
    elements = document.getElementsByClassName...

    next button increments cursor and scrollTo( elements[cursor] )
    prev button decrements cursor and scrollTo(...

    window.onscroll = function(){
    get the scroll position
    divide by element width
    set cursor to the new value
    }

View thread