Elgg  Version 4.3
Functions
ajax-append-auto.js File Reference

Go to the source code of this file.

Functions

 define (['jquery', 'page/components/list/ajax-append'], function($){var debounceTimeout;function debounce(func, wait, immediate){return function(){var context=this, args=arguments;var later=function(){debounceTimeout=null;if(!immediate) func.apply(context, args);};var callNow=immediate &&!timeout;clearTimeout(debounceTimeout);debounceTimeout=setTimeout(later, wait);if(callNow) func.apply(context, args);};};function checkScroll(){var $elem=$('.elgg-list-container-ajax-append-auto.elgg-pagination-next > a:visible');if(!$elem.length){return;}var docViewTop=$(window).scrollTop();var docViewBottom=docViewTop+$(window).height()+500;var elemTop=$elem.offset().top;var elemBottom=elemTop+$elem.height();if((elemBottom<=docViewBottom)&&(elemTop >=docViewTop)){$elem.click();}};$(document).off('scroll.ajax-append-auto');$(document).on('scroll.ajax-append-auto', debounce(checkScroll, 100));})
 Ajax lists - append behaviour with auto click if next navigation scrolls into window. More...
 

Function Documentation

define ( function($){var debounceTimeout;function debounce(func, wait, immediate){return function(){var context=this, args=arguments;var later=function(){debounceTimeout=null;if(!immediate) func.apply(context, args);};var callNow=immediate &&!timeout;clearTimeout(debounceTimeout);debounceTimeout=setTimeout(later, wait);if(callNow) func.apply(context, args);};};function checkScroll(){var $elem=$('.elgg-list-container-ajax-append-auto.elgg-pagination-next > a:visible');if(!$elem.length){return;}var docViewTop=$(window).scrollTop();var docViewBottom=docViewTop+$(window).height()+500;var elemTop=$elem.offset().top;var elemBottom=elemTop+$elem.height();if((elemBottom<=docViewBottom)&&(elemTop >=docViewTop)){$elem.click();}};$(document).off('scroll.ajax-append-auto');$(document).on('scroll.ajax-append-auto', debounce(checkScroll, 100));}  )

Ajax lists - append behaviour with auto click if next navigation scrolls into window.