Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
jquery-infinite-scroll-helper
Advanced tools
A lightweight implementation of the infinite scroll mechanic. By providing two essential callbacks, loadMore and doneLoading, the jQuery Infinite Scroll Helper plugin makes it a breeze to add infinite scrolling functionality to your page.
A lightweight implementation of the infinite scroll mechanic. By providing two essential callbacks, loadMore
and doneLoading
, the jQuery Infinite Scroll Helper plugin makes it a breeze to add infinite scrolling functionality to your page.
(number) The number of pixels from the bottom of the window in which the loadMore
callback should be invoked. The default is 0.
(number) The interval, in milliseconds, that the scroll event handler will be debounced.
(function) A callback that must return true
or false
, signaling whether loading has completed. This callback is passed a pageCount
argument.
(number) The interval, in milliseconds, that the doneLoading callback will be called by the plugin. It will stop being called once it returns true
. The default is 300.
(string) The class that will be added to the target element once loadMore
has been invoked. The default is loading
.
(string) A selector targeting the element that will receive the class specified by the loadingClass
option.
(function) A callback function that is invoked when the scrollbar eclipses the bottom threshold of the element being scrolled. This callback is passed two arguments:
pageCount
: The page number to loaded. This can be helpful when making requests to endpoints that require a page number.done
: A callback function that should be called when loading has completed. This is an alternative way to signal that you are done loading instead of defining the doneLoading
callback.(number) The amount of time, in milliseconds, before the loadMore callback is invoked once the bottom of the scroll container has been reached.
(string|HTMLElement) If provided, the element that the scroll listener will be attached to. This can either be a selector or a DOM element reference. If not specified, the plugin will try to find the first scrollable parent if the element itself is not scrollable.
(number) The starting page count that the plugin will increment each time the loadMore
callback is invoked. The default is 1.
(boolean) Whether or not the plugin should make an initial call to the loadMore
callback. This can be set to true
if, for instance, you need to load the initial content asynchronously on page load.
Destroys the plugin instance, removing all internal listeners and nullifying any external references.
$(selector).infiniteScrollHelper('destroy');
$('#my-element-to-watch').infiniteScrollHelper({
loadMore: function(page) {
// load some data, parse some data
},
doneLoading: function() {
// return true if you are done doing your thing, false otherwise
return false;
}
});
or when using the done
argument instead of the doneLoading
callback
$('#my-element-to-watch').infiniteScrollHelper({
loadMore: function(page, done) {
// you should use the page argument to either select an anchor/href and load
// the contents of that url or make a call to an API that accepts a page number
var nextPageUrl = $('.pagination a').eq(page - 1).attr('href');
$.get(nextPageUrl, function(data) {
$(data).find('.items').appendTo('#my-element-to-watch');
// call the done callback to let the plugin know you are done loading
done();
});
// or an API perhaps
$.getJSON('http://myawesomeapi.com/data?p=' + page, function(data) {
// parse json data and create new html then append
done();
});
}
});
The plugin can also be instantiated using constructor invocation
new InfiniteScrollHelper($('#my-element-to-watch')[0], options);
There will most likely be an issue with the scroll offset calculation when calling the plugin direclty on an element that is set to overflow: scroll-y in IE 6 & 7. In this case, it is best to wrap the children of the element in a container and call the plugin on this container instead.
scrollContainer
option.loadMore
callback when the window was scrolled past y0.loadMoreDelay
option. This allows you to set a delay before the loadMore
callback is invoked.done
argument is now passed to the loadMore
callback. You can invoke this callback to signal that you are done loading content instead of defining the doneLoading
callback option.debounceInt
option. The plugin now uses debouncing for the scroll event. You can specify the interval if you want it to be different than the default 100ms.loadingClassTarget
option.startingPageCount
option.triggerInitialLoad
option.doneLoading
callback now receives pageCount as a parameter.Copyright (c) 2014 Expand The Room, LLC
Licensed under the MIT license.
FAQs
A lightweight implementation of the infinite scroll mechanic. By providing two essential callbacks, loadMore and doneLoading, the jQuery Infinite Scroll Helper plugin makes it a breeze to add infinite scrolling functionality to your page.
We found that jquery-infinite-scroll-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.