From c4b070dd07805a3c83bff10019df829afbb3ed5e Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Fri, 9 Nov 2012 11:55:20 +0000 Subject: [PATCH] Custom Headers: Ensure the ready event fires before fetching the existing headers to apply jQuery.masonry. see #20346, #21820. git-svn-id: https://develop.svn.wordpress.org/trunk@22504 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/custom-header.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wp-admin/js/custom-header.js b/wp-admin/js/custom-header.js index 9243498175..05cc89a9e2 100644 --- a/wp-admin/js/custom-header.js +++ b/wp-admin/js/custom-header.js @@ -1,10 +1,13 @@ (function($) { + // Fetch available headers and apply jQuery.masonry + // once the images have loaded. + $( function() { + var $headers = $('.available-headers'); - var headers = $('.available-headers'); - headers.imagesLoaded( function() { - headers.masonry({ - itemSelector: '.default-header' + $headers.imagesLoaded( function() { + $headers.masonry({ + itemSelector: '.default-header' + }); }); }); - -})(jQuery); +}(jQuery));