Skip to content

Commit

Permalink
Rebalance: Update JavaScript to replace window.load event with docume…
Browse files Browse the repository at this point in the history
…nt.ready, as a work-around with an issue with the ads JavaScript. See #108.
  • Loading branch information
laurelfulford committed May 1, 2018
1 parent 83c4451 commit 93149c7
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions rebalance/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
$( document ).ready( function() {

/**
* Set variable
* Set variables
*/
var $container = $( '#infinite-wrap' );
var $container = $( '#infinite-wrap' ),
$wrapper = $( '.js body' );

/**
* Append HTML to masonry wrapper for responsive sizing
Expand All @@ -33,16 +34,6 @@
*/
$( '.entry-footer' ).append( $( '#jp-post-flair' ).detach() );

});

$( window ).on( 'load', function() {

/**
* Set variables
*/
var $wrapper = $( '.js body' ),
$container = $( '#infinite-wrap' );

/*
* Fade in page
* - only if js is enabled
Expand Down Expand Up @@ -71,16 +62,21 @@
'opacity' : 1
} );
});
});

// Handle new items appended by infinite scroll
$( document ).on( 'post-load', function() {
$container.imagesLoaded( function() {
$container.masonry( 'reloadItems').masonry( 'layout' );
// Fade in cards
$container.find( '.card' ).animate( {
'opacity' : 1
});
// Handle new items appended by infinite scroll
$( document ).on( 'post-load', function() {
/**
* Set variables
*/
var $container = $( '#infinite-wrap' );

$container.imagesLoaded( function() {
$container.masonry( 'reloadItems').masonry( 'layout' );
// Fade in cards
$container.find( '.card' ).animate( {
'opacity' : 1
});
});
});
} )( jQuery );
} )( jQuery );

0 comments on commit 93149c7

Please sign in to comment.