Hello Everyone.

I have created a "working" content slider with jQuery by following the following tutorial.

However, since my slider is a little different, I have removed some bits of code, and that of course has created some unusual behaviour in my content slider.

The content slides fine, however it keeps on sliding ! it doesn't stop when there are no more slides.

Can someone please help me write this function in proper jQuery code.

Code:
function  manageSlides (position){
  // position==0 is first slide
  if(position==0)  {
  // and $('#leftControl') is clicked > move to position numberOfSlides-1
  }
  else { 
  // do nothing .. it will work as it should
  }
  
  // numberOfSlides-1 is last slides
  if(position==numberOfSlides-1) {
  and $('#rightControl') is clicked > move to position==0
  }
  else { do nothing .. it should work as before }
}
I would greatly appreciate any help.

Thank You.