Search code examples
javascriptjqueryhtmlwebcycle

Why does this code continue to loop?


I have a simple jquery-script, embedded into my html code, it uses a plugin written for jquery, called cycle. When I try to use the code, it works, but it keeps looping for some reason. This means that I'm trying to create a simple slideshow, but when I click either "next" or "previous" it does what it should, but after that it continues to scroll the pictures without clicking. Why is this?

<script type="text/javascript">
$('#slide').cycle({
fx: 'scrollHorz',
speed:  'slow',
next:   '#righta',
prev:   '#lefta',
});
</script>

Solution

  • If you are using this plug in then auto scrolling is default behaviour unless you set timeout to 0. Try:

    <script type="text/javascript">
    $('#slide').cycle({
    fx: 'scrollHorz',
    speed:  'slow',
    next:   '#righta',
    prev:   '#lefta',
    timeout: 0
    });
    </script>