summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Kieffer <ckieffer@gmail.com>2009-08-10 23:11:31 -0600
committerChad Kieffer <ckieffer@gmail.com>2009-08-10 23:11:31 -0600
commite3a58b76c14c64a5254f4efd73730866818bd0b3 (patch)
tree0197111cda2928a40a86fa260b3d1d10ba638723
parentf7a23e0a9cdd4a85e4bc50964917d6995b7d54ab (diff)
Return .each() to work with more than an individual photo.
-rw-r--r--lib/gallery.common.js18
1 files changed, 10 insertions, 8 deletions
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());
+ }
+ });
};
/**