From e3a58b76c14c64a5254f4efd73730866818bd0b3 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Mon, 10 Aug 2009 23:11:31 -0600 Subject: Return .each() to work with more than an individual photo. --- lib/gallery.common.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/gallery.common.js') diff --git a/lib/gallery.common.js b/lib/gallery.common.js index 4db316c0..eea0fada 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -58,14 +58,16 @@ * @param elementID The image container's ID */ $.fn.gallery_fit_photo = function() { - var container_width = $(this).width(); - var photo = $(this).gallery_get_photo(); - var photo_width = photo.width(); - if (container_width < photo_width) { - var proportion = container_width / photo_width; - photo.width(container_width); - photo.height(proportion * photo.height()); - } + return this.each(function(i) { + var container_width = $(this).width(); + var photo = $(this).gallery_get_photo(); + var photo_width = photo.width(); + if (container_width < photo_width) { + var proportion = container_width / photo_width; + photo.width(container_width); + photo.height(proportion * photo.height()); + } + }); }; /** -- cgit v1.2.3