Javascript jQuery循环2悬停时反转

Javascript jQuery循环2悬停时反转,javascript,jquery,jquery-cycle2,Javascript,Jquery,Jquery Cycle2,所以我尝试使用Cycle2插件创建一个旋转木马。与此不同的是,在单击“下一步”和“上一步”按钮时,它不仅会来回循环,在将鼠标悬停在按钮上时,它还会开始来回循环 我可以用下面的代码为下一个按钮创建此行为,该代码暂停旋转木马,并在下一个按钮悬停时继续 $('.cycle-slideshow').cycle('pause'); $('#next').hover(function () { //mouse enter - Resume the slideshow $('.cycle-s

所以我尝试使用Cycle2插件创建一个旋转木马。与此不同的是,在单击“下一步”和“上一步”按钮时,它不仅会来回循环,在将鼠标悬停在按钮上时,它还会开始来回循环

我可以用下面的代码为下一个按钮创建此行为,该代码暂停旋转木马,并在下一个按钮悬停时继续

$('.cycle-slideshow').cycle('pause');

$('#next').hover(function () {
    //mouse enter - Resume the slideshow
    $('.cycle-slideshow').cycle('resume');
}, function () {
    //mouse leave - Pause the slideshow
    $('.cycle-slideshow').cycle('pause');
});
我不知道如何在上一个按钮悬停时反转幻灯片的方向。有什么想法吗

非常感谢您的任何意见。提前感谢。

假设
。循环('prev')
不会解除传送带的暂停。如果是这样,则需要在每次调用
.prev
并使用鼠标离开功能后再次暂停

尝试以下方法:

var intervalVar;

$('#prev').hover(function () {
    //mouse enter - Resume the slideshow
    intervalVar = setInterval(function(){
        $('.cycle-slideshow').cycle('prev');
    },1000);
}, function () {
    //mouse leave - Pause the slideshow
    clearInterval(intervalVar);
});

这假设您每1秒循环一次。。您可以更改
1000
以匹配您的旋转木马设置为转换的毫秒数。

谢谢,这是正确的。