Ho can I transform my following lazy loading with more button to lazy loading with on scroll loading?
function openFromButton(lastLoadedIndex) {
lastLoadedIndex = (typeof(lastLoadedIndex)=='undefined') ? '' : lastLoadedIndex;
jQuery.get('liste.asp?from_item='+ lastLoadedIndex +'¶m='+(new Date()).getTime(), function(data) {
//alert(data);
jQuery("#liste_body").append(data);
});
This what I've have done so far, it works fine, but the problem is it loads when I scroll vertically or horizontally. How can I just make it work on vertical scroll ?
function addEvent( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else
obj.addEventListener( type, fn, false );
}
addEvent(window, 'scroll', function(event) {
openFromButton();
});