? galleryformatter-826932.patch
? galleryformatter-854522.patch
Index: theme/galleryformatter.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleryformatter/theme/galleryformatter.js,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 galleryformatter.js
--- theme/galleryformatter.js	5 Jun 2010 12:18:34 -0000	1.1.2.4
+++ theme/galleryformatter.js	17 Jul 2010 13:35:55 -0000
@@ -19,19 +19,16 @@ Drupal.galleryformatter.prepare = functi
   var $thumbs = $('.gallery-thumbs', $el);
   var $thumbsLi = $('li', $thumbs);
   var thumbWidth = $thumbsLi.filter(':first').width() + 'px';
+  var liWidth = $thumbsLi.outerWidth(); // includes padding
 
   /*
-   * @fixme
-   * Only start the thumbs carrousel if needed ?
-   * This can get very messy with padding etc
-   * Reluctant to implement for now, though the if commented here seems to work fine
+   * Only start the thumbs carrousel if needed
    */
-  // if (($thumbsLi.size() * parseInt(thumbWidth)) >= $slideContainer.width()) {
-  $('ul', $thumbs).width('9999px');
-  $thumbs.infiniteCarousel();
-  //}
-
-  $thumbsLi = $('li', $thumbs); // we need to reselect because infiniteCarousel inserts new empty li elements if necessary
+  if (($thumbsLi.size() * liWidth) > $thumbs.width()) {
+    $('ul', $thumbs).width('9999px');
+    $thumbs.infiniteCarousel();
+    $thumbsLi = $('li', $thumbs); // we need to reselect because infiniteCarousel inserts new empty li elements if necessary
+  }
 
   $thumbsLi.each(function(){
     $(this).css({
