Actually this plugin will not load new pages and append new elements, it only will work with jQuery events to warn you when the scroll reach the limit of the binder scroll. (Lightweight plugin ~ 3kb minified)
IE 9+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
Three quick start options are available:
- Download latest release
- Clone the repo:
git@github.com:dhyegofernando/jquery-reach-scroll.git
- Install with Bower:
bower install jquery-reach-scroll
Use Bower to fetch all dependencies:
$ bower install
Now you're ready to go!
Create an element to be called:
<ul id="my-list"></ul>
Include jQuery (1.7.0+):
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
Include JS:
<script src="jquery.reach-scroll.min.js"></script>
Call the plugin:
$("#my-list").reachScroll();
That's it!
Here's a list of available settings.
$("#my-list").reachScroll({
binder: $(window),
pause: false,
pauseIfOccurs: false,
extraScrollPx: 0,
onReached: function() {}
});
Attribute | Type | Default | Description |
---|---|---|---|
binder |
DOM/jQuery | $(window) |
The element that will be bound to the scroll event. |
pause |
Boolean | false |
Defines the plugin status. |
pauseIfOccurs |
Boolean | false |
Whether the plugin will be pause after the first reached event. |
extraScrollPx |
Integer | 0 |
Extra pixels before reach limit of the binder. |
onReached |
Function | null |
Function that will be called as event listener on limit of the binder. |
You can also set the reached event like that if you prefer:
$("#my-list").on("scrollreached", function() {});
The basic structure of the project is given in the following way:
.
|-- demo/
| |-- css
| |-- js
| |-- index.html
|-- dist/
| |-- jquery.reach-scroll.js
| |-- jquery.reach-scroll.min.js
|-- src/
| |-- jquery.reach-scroll.js
|-- .editorconfig
|-- .gitignore
|-- .jshintrc
|-- .travis.yml
|-- bower.json
|-- CONTRIBUTING.md
|-- Gruntfile.js
|-- reach-scroll.jquery.json
|-- package.json
`-- README.md
Contains all dependencies like jQuery.
Contains a simple HTML file to demonstrate the plugin.
This is where the generated files are stored once Grunt runs JSHint and other stuff.
Contains the files responsible for the plugin.
This file is for unifying the coding style for different editors and IDEs.
Check editorconfig.org if you haven't heard about this project yet.
List of files that we don't want Git to track.
Check this Git Ignoring Files Guide for more details.
List of rules used by JSHint to detect errors and potential problems in JavaScript.
Check jshint.com if you haven't heard about this project yet.
Definitions for continous integration using Travis.
Check travis-ci.org if you haven't heard about this project yet.
Package manifest file used to publish plugins in jQuery Plugin Registry.
Check this Package Manifest Guide for more details.
Contains all automated tasks using Grunt.
Check gruntjs.com if you haven't heard about this project yet.
Specify all dependencies loaded via Node.JS.
Check NPM for more details.
Have you used this plugin in your project?
Let me know! Send a tweet or pull request and I'll add it here :)
Do you prefer a version with add elements feature or pagination?
No problem, @paulirish already did one. Check his fork!
Check CONTRIBUTING.md.
Check Releases for detailed changelog.
Built on top of jQuery Boilerplate.
MIT License © Dhyego Fernando