diff --git a/theme/galleryformatter.js b/theme/galleryformatter.js index b81a5a4..c33640a 100644 --- a/theme/galleryformatter.js +++ b/theme/galleryformatter.js @@ -1,10 +1,12 @@ Drupal.behaviors.galleryformatter = { attach: function (context) { - (jQuery)('.galleryformatter:not(.gallery-processed)', context).each(function(){ - Drupal.galleryformatter.prepare(this); - - }).addClass('gallery-processed'); + // We must wait for everything to load in order to get images' dimensions. + (jQuery)(window).bind('load', function() { + (jQuery)('.galleryformatter:not(.gallery-processed)', context).each(function(){ + Drupal.galleryformatter.prepare(this); + }).addClass('gallery-processed'); + }); } };