Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/omgimalexis/infinitescroll

Tumblr Infinite Scroll
https://github.com/omgimalexis/infinitescroll

Last synced: 29 days ago
JSON representation

Tumblr Infinite Scroll

Awesome Lists containing this project

README

        

Tumblr Infinite Scroll
==============


Add this to your theme before head> and then replace .post with your post class/ID and #posts with your post wrapper class/ID.
```

$(document).ready(function() {
//http://www.shambix.com/en/isotope-twitter-bootstrap-infinite-scroll-fluid-responsive-layout/
var $container = $('#posts');
// Fire Isotope only when images are loaded
$container.imagesLoaded(function(){
$container.isotope({
itemSelector : '.post',
masonry: {
}
});
});

// Infinite Scroll
$('#posts').infinitescroll({
navSelector : '#pagination',
nextSelector : '#pagination a',
itemSelector : '.post',
bufferPx : 200,
loading: {
finishedMsg: 'We\'re done here.',
}
},

// Infinite Scroll Callback
function( newElements ) {
var $newElems = jQuery( newElements ).hide();
$newElems.imagesLoaded(function(){
$newElems.fadeIn();
$container.isotope( 'appended', $newElems );
});
});

if ($('.post:last').position().top > 200) {
$('#posts').infinitescroll('retrieve');
}
});

```