, - css. , . $
, $ , ,
BTW, , , , , , .
=== UPDATE ===
, infinitescroll, script, pathParse script
$(function () {
var $container = $('#itemContainer');
$container.imagesLoaded(function () {
$container.masonry({
itemSelector:'.item'
});
});
$container.infinitescroll({
navSelector:'.navigation',
nextSelector:'.navigation #next',
itemSelector:'.item',
bufferPx:40,
debug:true,
columnWidth:function (containerWidth) {
return containerWidth / 5;
},
loading:{
finishedMsg:'No more pages to load.',
img:'http://i.imgur.com/6RMhx.gif'
},
pathParse: function(path,page){
return $(this.nextSelector).attr("href");
}
},
function (newElements) {
var $newElems = $(newElements).css({ opacity:0 });
$newElems.imagesLoaded(function () {
$newElems.animate({ opacity:1 });
$container.masonry('appended', $newElems, true);
});
}
);
});
, (http://reddit.ymindustries.com/?after=t3_yh4av), , ajax ... -
function (newElements) {
var $newElems = $(newElements).css({ opacity:0 });
var lastImageUrl= $newElements[$newElements.length-1].attr("src");
var lastFileName= lastImageUrl.substring(lastImageUrl.lastIndexOf("/") +1, lastImageUrl.lastIndexOf("."));
$("#next").attr("href", "http://reddit.ymindustries.com/?after="+lastFileName);
$newElems.imagesLoaded(function () {
$newElems.animate({ opacity:1 });
$container.masonry('appended', $newElems, true);
});
}