Created
October 22, 2015 03:34
-
-
Save srinathweb/3c67d19d7215fcea0b79 to your computer and use it in GitHub Desktop.
load more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Have you heard about the jQuery Waypoint plugin. | |
| Below is the simple way of calling a waypoints plugin and having the page load more Content once you reaches the bottom on scroll : | |
| $(document).ready(function() { | |
| var $loading = $("<div class='loading'><p>Loading more items…</p></div>"), | |
| $footer = $('footer'), | |
| opts = { | |
| offset: '100%' | |
| }; | |
| $footer.waypoint(function(event, direction) { | |
| $footer.waypoint('remove'); | |
| $('body').append($loading); | |
| $.get($('.more a').attr('href'), function(data) { | |
| var $data = $(data); | |
| $('#container').append($data.find('.article')); | |
| $loading.detach(); | |
| $('.more').replaceWith($data.find('.more')); | |
| $footer.waypoint(opts); | |
| }); | |
| }, opts); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment