Adding a Next/Prev that moves images in a "carousel" fasion.

Adding a Next/Prev that moves images in a "carousel" fasion.

We have a lightbox slider on our website, and it contains a little carousel at the bottom with clickable images. When you click one, it displays larger in the center of the lightbox. 

I'm trying to add next/prev actions to the thumbnail carousel slider, so that a user can click next, and see 5 more thumbnails they could potentially click on.. if that makes sense. 

Right now the script tied to the carousel is 

  1. /**
  2.  * Set the gallery thumbnails
  3.  */
  4. (function($)
  5. {
  6. $.fn.setThumbnailData = function( gallery_id, photo_id )
  7. {
  8. // The data we're working with
  9. var data = suprflickr[gallery_id].photos;

  10. // The string to set
  11. var str = "";
  12. for ( p in data )
  13. {
  14. if (photo_id == data[p].id)
  15. str += "<a href='#' gallery_id='" + gallery_id + "' photo_id='" + data[p].id + "' class='thumb current'>";
  16. else
  17. str += "<a href='#' gallery_id='" + gallery_id + "' photo_id='" + data[p].id + "' class='thumb'>";
  18. str += "<span class='img'><img src='" + data[p].url_sq + "' /></span>";
  19. str += "</a>";
  20. }
  21. // Set the content
  22. $(this).find('.slider').html( str );
  23. // Set the actions on the thumbnails
  24. $(this).find('.thumb').unbind('click').click(function()
  25. {
  26. var t = $('#suprflickrGallery .list .content a[photo_id="' + $(this).attr('photo_id') + '"]');
  27. $('#suprflickrLB').setLightboxData($(t), 'fade');
  28. $('#suprflickrGallery .list .content a.current').removeClass('current');
  29. $(this).addClass('current');
  30. $(t).addClass('current');
  31. $(this).parent().setThumbnailSliderPosition();
  32. return false;
  33. });
  34. // Set the width of the thumbnail container
  35. $(this).find('.slider').setThumbnailSliderPosition();
  36. }
  37. })(jQuery);
You can see the example here :  http://d.perich.com/grand-hotel/2013/index.php/named-rooms#72157623652852736&7160479178

Any help would be greatly appreciated.