1
votes

I'm using jquery to cycle through images on page load, like in this example:

http://buildinternet.com/live/cycle-images/

JQUERY

$('.diapositivas').cycle({
                fx:     'none',
                speed:   100,
                timeout: 70,
                cleartypeNoBg:true
            }).cycle("pause");


        function runThrough(){
                $('.start-page-img .diapositivas').addClass('active').cycle('resume');
            }

        runThrough();

HTML

<div class="start-page-img">
    <a href="http://website.com" class="link"></a>
    <ul class="diapositivas">
        <li><img src="image.jpg"/></li>
        <!-- Any other slides -->
    </ul>
</div>

Is there a way I can stop the cycle when it reaches the last image or a certain image?

Thanks!

2

2 Answers

1
votes

Just use autostop option

JAVASCRIPT:

$('.diapositivas').cycle({
    fx:     'none',
    speed:   100,
    timeout: 70,
    autostop: 1
}).cycle("resume");

DEMO: http://jsfiddle.net/dirtyd77/SLGdE/7/

0
votes

look if your cycle() plugin provides any callbacks and use an appropriate one to check where you are at and if you should call cycle("pause").