Created
April 12, 2012 16:12
-
-
Save p3drosola/2368723 to your computer and use it in GitHub Desktop.
Piccsy infinite scroll
This file contains 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
// requires Infinite Scroll plugin by Paul Irish | |
// https://github.com/paulirish/infinite-scroll/blob/master/jquery.infinitescroll.min.js | |
$(function() { | |
if ($('#leftColumn').length > 0){ | |
var $ci = $('<div id="container-inner"></div>').prependTo('#container'); | |
$('#header, #fbFloat, #wrapper, #leftColumn, #rightColumn').detach().appendTo($ci); | |
$ci.infinitescroll({ | |
navSelector: "#pager", | |
nextSelector: "#pager li:nth-child(2) a", | |
itemSelector: ".image", | |
loadingText: "Loading more images..." | |
}, function (elements) { | |
var $left = $('#leftColumn'), | |
$center = $('#centerColumn'), | |
$right = $('#rightColumn'); | |
$(elements).each(function () { | |
var $spacer = $('<div>').addClass('spacer'), | |
$col = ($left.outerHeight() < $center.outerHeight()) ? $left : $center; | |
$col = ($right.outerHeight() < $col.outerHeight()) ? $right : $col; | |
$(this).detach().appendTo($col).after($spacer); | |
}); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment