You could write your own simple plugin using jQuery.
$.belowViewport = function(elem){
var port = $(window).scrollTop() + $(window).height();
return port <= $(elem).offset().top;
}
$.fn.onBecomeVisible = function( fn ){
var obj = this;
$(window).scroll( function() {
obj.each( function() {
if(!$.belowViewport(this) && !$(this).data('scrollEventFired')){
$(this).data('scrollEventFired', true);
fn(this);
}
});
});
return this;
}
And then use it like this
$('.elements:last').onBecomeVisible( function(elem){ loadNewElems(); } );
The script will bind fn to each of the matched ellements. The function will be fired when any of the matched elements scrolls into view. The function will also be passed which element has fired the event.
Note that you can not bind this event using live so you will have to rebind it after adding new elements (presuming you want the event on the last one of those too.).
EDIT
I was wrong here, :visible does not return wether or not an element is in the viewport. However I have edited the source so it now does check if an element is in the viewport. The function checks if the element is below the viewport, we assume that if it isn't below the viewport it has been scrolled into view and that we should execute the function.
EDIT2
Tested this in google chrome 1.0, firefox 3.0.10 and IE7