? gallerystyles/greenarrows/images/next-prev.png
Index: gallerystyles/greenarrows/greenarrows.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleryformatter/gallerystyles/greenarrows/greenarrows.css,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 greenarrows.css
--- gallerystyles/greenarrows/greenarrows.css	16 May 2010 16:41:37 -0000	1.1.2.4
+++ gallerystyles/greenarrows/greenarrows.css	14 Sep 2010 19:10:44 -0000
@@ -89,3 +89,38 @@
 .galleryformatter-greenarrows .gallery-thumbs .forward:hover { background-position: 0px -52px; }
 
 .galleryformatter-greenarrows .gallery-thumbs .back:hover { background-position: -4px -156px; }
+
+.gallery-slides { position: relative; }
+
+.galleryformatter-greenarrows .slide-button {
+  background: transparent url(images/next-prev.png) no-repeat top left;
+  height: 64px;
+  width: 32px;
+  display: block;
+  cursor: pointer;
+  text-indent: -9999px;
+  bottom: 40%;
+  position: absolute;
+  filter:alpha(opacity=20);
+  -ms-filter:”alpha(opacity=20)”;
+  -moz-opacity:0.2;
+  -khtml-opacity: 0.2;
+  opacity: 0.2;
+}
+
+.galleryformatter-greenarrows .prev-slide {
+  background-position: top left;
+  left: 0;
+}
+.galleryformatter-greenarrows .next-slide {
+  background-position: top right;
+  right: 0;
+}
+.galleryformatter-greenarrows .slide-button:hover {
+    filter: alpha(opacity=100);
+  -ms-filter: ”alpha(opacity=100)”;
+  -moz-opacity: 1;
+  -khtml-opacity: 1;
+  opacity: 1;
+}
+
Index: theme/galleryformatter.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleryformatter/theme/galleryformatter.js,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 galleryformatter.js
--- theme/galleryformatter.js	9 Sep 2010 19:40:23 -0000	1.1.2.8
+++ theme/galleryformatter.js	14 Sep 2010 19:10:44 -0000
@@ -19,6 +19,8 @@ Drupal.galleryformatter.prepare = functi
   var $thumbsLi = $('li', $thumbs);
   var thumbWidth = $thumbsLi.filter(':first').width() + 'px';
   var liWidth = $thumbsLi.outerWidth(); // includes padding
+  var $wrapper = $('.wrapper', $el);
+  var visibleWidth = $wrapper.outerWidth();
 
   /*
    * Only start the thumbs carrousel if needed
@@ -26,7 +28,9 @@ Drupal.galleryformatter.prepare = functi
   if (($thumbsLi.size() * liWidth) > $thumbs.width()) {
     $('ul', $thumbs).width('99999px');
     $thumbs.infiniteCarousel();
-    $thumbsLi = $('li', $thumbs); // we need to reselect because infiniteCarousel inserts new empty li elements if necessary
+    // we need to reselect because infiniteCarousel inserts new empty li elements if necessary
+    $el = $(el);
+    $thumbsLi = $('.gallery-thumbs ul li', $el);
   }
 
   $thumbsLi.each(function(){
@@ -85,4 +89,58 @@ Drupal.galleryformatter.prepare = functi
   else {
     showFirstSlide();
   }
+
+    /*
+   * Create a public interface to move to the next and previous images
+   */
+  // Shows the previous slide and scrolls to the previous page if necessary
+  $thumbs.bind('showPrev', function (event) {
+    var currentScroll = $wrapper.get(0).scrollLeft;
+    var $prevThumbLi = $thumbsLi.filter('.active').prevAll().not('.empty, .cloned').filter(':first');
+    // if no results we are on the first element
+    if(!$prevThumbLi.size()) {
+      // select the last one
+      $prevThumbLi = $thumbsLi.not('.empty, .cloned').filter(':last');
+    }
+    var $slideToClick = $('a', $prevThumbLi);
+    var $prevIsVisible = (($prevThumbLi.get(0).offsetLeft >= currentScroll) && ($prevThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll)));
+    if($prevIsVisible) {
+      $slideToClick.trigger('click');
+    }
+    else {
+      $thumbs.trigger('prev');
+      $slideToClick.trigger('click');
+    }
+  });
+  // Shows the next slide and scrolls to the next page if necessary
+  $thumbs.bind('showNext', function (event) {
+    var currentScroll = $wrapper.get(0).scrollLeft;
+    var $nextThumbLi = $thumbsLi.filter('.active').nextAll().not('.empty, .cloned').filter(':first');
+    // if no results we are on the last element
+    if(!$nextThumbLi.size()) {
+      // select the first one
+      $nextThumbLi = $thumbsLi.not('.empty, .cloned').filter(':first');
+    }
+    var $slideToClick = $('a', $nextThumbLi);
+    var $nextIsVisible = (($nextThumbLi.get(0).offsetLeft >= currentScroll) && ($nextThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll)));
+    if($nextIsVisible) {
+      var $slideToClick = $('a', $nextThumbLi);
+      $('a', $nextThumbLi).trigger('click');
+    }
+    else {
+      $thumbs.trigger('next');
+      $slideToClick.trigger('click');
+    }
+  });
+
+   // Setup buttons for next/prev slide
+  $slideButtons = ('<a class="prev-slide slide-button" title="'+ Drupal.t('Previous image') +'">&lt;</a><a class="next-slide slide-button" title="'+ Drupal.t('Next image') +'">&gt;</a>');
+  $('.gallery-slides', $el).append($slideButtons);
+  // Trigger the appropiate events on click
+  $('a.prev-slide', $el).click(function(){
+    $thumbs.trigger('showPrev');
+  });
+  $('a.next-slide', $el).click(function(){
+    $thumbs.trigger('showNext');
+  });
 };
Index: theme/infiniteCarousel.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleryformatter/theme/infiniteCarousel.js,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 infiniteCarousel.js
--- theme/infiniteCarousel.js	23 May 2010 11:15:58 -0000	1.1.2.1
+++ theme/infiniteCarousel.js	14 Sep 2010 19:10:45 -0000
@@ -78,5 +78,13 @@ $.fn.infiniteCarousel = function () {
         $(this).bind('goto', function (event, page) {
             gotoPage(page);
         });
+
+        // custom events to trigger next and prev pages
+        $(this).bind('next', function () {
+          gotoPage(currentPage + 1);
+        });
+        $(this).bind('prev', function () {
+          gotoPage(currentPage - 1);
+        })
     });
 };
