From 156e782313d8b35d135d02c7102e7ea6b9bd3178 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: http://core.svn.wordpress.org/trunk@22504 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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));