Eliminating Pagination with Ajax

Discussion in 'Javascript' started by Rich Hephner, Jul 24, 2007.

  1. Rich Hephner

    Rich Hephner Guest

    I have a search application that currently returns results 10 at a
    time with a next page button for more. I'm trying to move to a system
    similar to that on A9.com where new results are added to the existing
    set as the user scrolls down the page. Also featured here (http://
    molly.com/index.php?s=pagination&submit=go) The concept is easy
    enough, but implementation is proving difficult. The results appear
    within a div that has overflow set to auto.

    The question is: How do I detect when the user has scrolled to the
    bottom of the current set of results?

    Thank you.
     
    Rich Hephner, Jul 24, 2007
    #1
    1. Advertising

  2. Rich Hephner

    David Mark Guest

    On Jul 24, 11:09 am, Rich Hephner <> wrote:
    > I have a search application that currently returns results 10 at a
    > time with a next page button for more. I'm trying to move to a system
    > similar to that on A9.com where new results are added to the existing
    > set as the user scrolls down the page. Also featured here (http://
    > molly.com/index.php?s=pagination&submit=go) The concept is easy
    > enough, but implementation is proving difficult. The results appear
    > within a div that has overflow set to auto.
    >
    > The question is: How do I detect when the user has scrolled to the
    > bottom of the current set of results?


    var el = document.getElementById("scroller");
    if (el) el.onscroll = function() {if (this.scrollTop ==
    this.scrollHeight - this.clientHeight) alert('At bottom')};

    Watch out as this won't work with some older browsers. I don't think
    Opera 8 will even fire the onscroll event for anything but the window
    object.
     
    David Mark, Jul 24, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Guy
    Replies:
    3
    Views:
    611
    Paul Guy
    May 27, 2004
  2. A.T.
    Replies:
    1
    Views:
    466
    David Carlisle
    Jul 22, 2004
  3. Matt B
    Replies:
    6
    Views:
    468
    Matt B
    Oct 8, 2005
  4. David Heinemeier Hansson
    Replies:
    7
    Views:
    119
    Glenn Smith
    Mar 24, 2005
  5. newbie

    pagination with ajax

    newbie, Dec 12, 2007, in forum: Javascript
    Replies:
    2
    Views:
    98
    newbie
    Dec 13, 2007
Loading...

Share This Page