This repository has been archived on 2022-08-01. You can view files and clone it, but cannot push or open issues or pull requests.
Oldphaloskepsis/plugins/infinite-scroll/behaviors/local.js
2017-01-12 23:10:07 +00:00

26 lines
1 KiB
JavaScript

// Calculate internal height (used for local scroll)
// this function is from the old localMode I think?
function infsrc_local_hiddenHeight(element) {
var height = 0;
jQuery(element).children().each(function() {
height = height + jQuery(this).outerHeight(false);
});
return height;
}
jQuery.extend(jQuery.infinitescroll.prototype,{
_nearbottom_local: function infscr_nearbottom_local() {
var opts = this.options, instance = this,
pixelsFromWindowBottomToBottom = infsrc_local_hiddenHeight(opts.binder)
- jQuery(opts.binder).scrollTop() - jQuery(opts.binder).height();
if (opts.local_pixelsFromNavToBottom == undefined){
opts.local_pixelsFromNavToBottom = infsrc_local_hiddenHeight(opts.binder) +
jQuery(opts.binder).offset().top - jQuery(opts.navSelector).offset().top;
}
instance._debug('local math:', pixelsFromWindowBottomToBottom,
opts.local_pixelsFromNavToBottom);
return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.local_pixelsFromNavToBottom);
}
});