Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #40 from Codeinwp/development
Browse files Browse the repository at this point in the history
Fixed Issue with Jetpack Infinite scroll
  • Loading branch information
rodica-andronache authored Aug 26, 2016
2 parents f8815f9 + 091886e commit 55e7079
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 12 deletions.
53 changes: 42 additions & 11 deletions js/masonry-init.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@

//Masonry init
jQuery(function($) {
var $container = $('.grid-layout');
$container.imagesLoaded( function() {
$container.masonry({
itemSelector: '.hentry',
isAnimated: true,
animationOptions: {
duration: 300,
easing: 'linear',
}
});
});

var $container;

function nsc_trigger_masonry() {
// don't proceed if $grid has not been selected
if ( !$container ) {
return;
}
// init Masonry
$container.imagesLoaded( function() {
$container.masonry({
itemSelector: '.hentry',
isAnimated: true,
animationOptions: {
duration: 300,
easing: 'linear',
}
});
});
}

$(window).load(function(){
$container = $('.grid-layout'); // this is the grid container

nsc_trigger_masonry();

// Triggers re-layout on infinite scroll
$( document.body ).on( 'post-load', function () {

// I removed the infinite_count code
var $selector = $('.infinite-wrap');
var $elements = $selector.find('.hentry');

/* here is the idea which is to catch the selector whether it contain element or not, if it's move it to the masonry grid. */
if( $selector.children().length > 0 ) {
$container.append( $elements ).masonry( 'appended', $elements, true );
nsc_trigger_masonry();
}

});
});

});
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: http://themeisle.com/themes/oblique
Author: Themeisle
Author URI: http://themeisle.com/
Description: Oblique is a creative masonry theme that works great for fashion or general bloggers. Amongst the features you will find a a parallax header image, full color control with unlimited color variations, easy access to all Google Fonts, responsive design etc.
Version: 1.12
Version: 1.13
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: oblique
Expand Down

0 comments on commit 55e7079

Please sign in to comment.