tags:

views:

27

answers:

3

Hi Guys and Girls

I apologise if this is a straightforward question. How can I make the slider stop playing once it reaches the final slide?

We're running against a massive deadline at work and, tho I'll could work it out with the midnight oil burning, I was hoping this is a simple question for one of you.

If anyone could help it would be hugely appreciated.

Cheers

Ian

A: 

Sorry I should have been more specific but thanks for your quick response.

It's the anythingSlider developed by Chris Coyier: http://css-tricks.com/examples/AnythingSlider/

Many thanks

Ian
A: 

There is no native support for stopping the auto play on the last slide. I don't have the time just now to make an example but it looks like you can ammend the js file to stop the autoplay after the last slide.

In line number 136 of the js file, replace the existing function with the following:

base.goForward = function(autoplay){
if(autoplay !== true) autoplay = false;

if(autoplay && base.currentPage == base.$items.length()-1) {
base.startStop(false); // stops auto play
return;
}
base.gotoPage(base.currentPage + 1, autoplay);
};

I can't test this just now but it shouldn't be far away from your requirement.

Brian Scott
A: 

Thanks for that Brian, really appreciate the quick response and you were almost spot on. The only change needed was to base.$items.length()-1

The correct code, for anyone who might want to use it, is:

base.goForward = function(autoplay){
    if(autoplay !== true) autoplay = false;
    if(autoplay && base.currentPage == base.pages) {
        base.startStop(false); // stops auto play
        return;
    }
    base.gotoPage(base.currentPage + 1, autoplay);
};

Thanks once again Brian

Regards

Ian

Ian