Cav
Cav

Reputation: 162

jQuery Cycle not resuming when paused

I get a really weired behaviour on my server. That's my code:

<script type="text/javascript">
jQuery(function($){
    $(".slides").cycle({
        fx:     'none',
        speed:   1,
        timeout: 1000,
        width: 160,
        height: 120
    }).cycle("pause");

    // Pause & play on hover
    $(".slideshow-block").hover(function(){
        $(this).find(".slides").addClass("active").cycle("resume");
    }, function(){
        $(this).find(".slides").removeClass("active").cycle("pause");
    });

});
</script>

The HTML looks like this:

<div class="slideshow-block">
  <ul class="slides">
    <li><img src="img1.jpg" /></li>
    <li><img src="img2.jpg" /></li>
    <li><img src="img3.jpg" /></li>
  </ul>
</div></div>

Now, if I use .cycle("pause") in the beginning, the hover functions are not being executed. If I skip the pause in the begining, the slide show is running when the web site is loaded, it keeps running when I move the mouse over the image and it stops when the mouse leaves the image area, everything as it is supposed to be. Why is this not working when I start the slideshow paused?

Thanks for any hints.

Upvotes: 0

Views: 366

Answers (1)

lucuma
lucuma

Reputation: 18339

Your code runs fine in jsfiddle.

http://jsfiddle.net/lucuma/pssgN/1/

The HTML above has a dangling closing div..

Upvotes: 1

Related Questions