0

I have done the jQuery cycle in my practice web design. My problem is, I want the script to start on mouse hover but what happens is when I refresh the page, it starts already. On my 1st mouse over, it stops. Then the 2nd mouse over, it starts to do the slideshow and stops when it's mouse out. Here's the code:

jQuery(function($){

    // Cycle plugin
    $('.slides').cycle();

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

});

I tried putting 'pause' or "pause" in $('.slides').cycle(); but it actually destroys the plugin and there is no more effect. Thanks for the help! :)

4

2 に答える 2

0

私はすでに答えを見つけました、私はこれをしました:

$('.slides').cycle().cycle('pause');
于 2013-04-25T09:52:39.333 に答える
0

.mouseover.mouseout.mouseenterまたはを使用.mouseleaveして、マウス操作をより適切に制御できます。

例:

$(".slideshow-block").mouseover(function() {
  $(this).find(".slides").addClass('active').cycle('resume');
}).mouseout(function(){
  $(this).find(".slides").removeClass('active').cycle('pause');
});
于 2013-04-25T09:48:04.963 に答える