Eliminating Pagination with Ajax

R

Rich Hephner

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.
 
D

David Mark

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top