views:

274

answers:

0

Pretty simple question, I know it's just a matter of if / else if statements but I'm unable to get them to run correctly.

I'm using the basis of http://jqueryfordesigners.com/coda-slider-effect/, I can get them hidden, etc, but when it comes to having them available depending on the situation (what is currently selected) I'm just unable to get it to work correctly.

There's a serialscroll plugin for it, but, it doesn't seem to be working for coda-slider.

jQuery(function( $ ){
var $prev = $('#before'),//prev button
 $next = $('#after');//next button

$('.slider').serialScroll({
 //...
 cycle:false, //you probably don't want this
 onBefore:function( e, elem, $pane, $items, pos ){
  $prev.add($next).show();
  if( pos == 0 )
   $prev.hide();
  else if( pos == $items.length-5 )
   $next.hide();
 }
 //...
});

});

So, I'm not sure if I'm missing something on the serialscroll side, or should just write a simple situational piece of JS for it, which I'm having trouble doing!

I have used and have set cycle: false as you can see, and while it will stop scrolling and make the buttons do nothing, they will not dissapear

Thanks in advance!