Slideshow: next btn only on 1st img

dominicbell / 2010-12-16 16:20:22   

Hi Everyone, this is a simple portfolio site I'm designing:

dominic-bell.com/ug

I'm pretty familiar with Indexhibit (I like to think!) but really need some help with this problem with the slideshow plugin. This is how it works on my site:

http://dominic-bell.com/ug/index.php?/fashion/laurence-ellis

What I want to do is hide the 'previous' arrow on the first image, and (naturally) hide the 'next' arrow on the last image.

I reckon it can be done by using the 'after' callback which is built into the jquery cycle plugin. I guess by integrating here somehow:

function dynamicJS()
{
global $timeout;
return "$(document).ready(function(){
$('#image').cycle({
timeout: 0,
next:'#next', prev:'#prev',
});
});";
}

I've tried and failed. Any ideas??

Thanks for your time
Dom

G470 / 2010-12-17 04:34:55   

Hey dominicbell,

I have a solution for this. You have to update your jquery cyle plugin first. otherwise it won´t work.

Download the current jquery cycle Plugin and replace the content of your current file.

Then go to your exhibit.slideshow.php and add this code to your dynamicJS function.

  1. $(document).ready(function(){ 
  2.     function onAfter(curr, next, opts) {    
  3.     var index = opts.currSlide;    
  4.     $('#prev')[index == 0 ? 'hide' : 'show']();   
  5.     $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
  6.     var caption = 'Image ' + (opts.currSlide + 1) + ' / ' + opts.slideCount;    $('#num').html(caption);
  7.      }

    $('#s1').cycle({
    fx:'fade',
    speed:'2000',
    timeout: 0,
    next:'#next',
    prev:'#prev',
    after: onAfter    
    });
    });

This thread has been closed, thank you.