我试图弄清楚如何做到这一点......我有一个移动div的函数,这个函数有一个速度属性(500毫秒),它用于动画和移动div..所以,我基本上在尝试要做的是每次我通过按钮调用该函数时,问题是我离开鼠标后无法停止间隔(我正在使用mouseenterand mouseleave)并且我想调用该函数延迟 500ms 来调用它(我试过了myfunction().delay(500);)但它的结果是一样的......
知道怎么做吗?以及如何停止我在 mouseleave 上的间隔?
(对于我正在使用的 mouseleave clearInterval(myinterval);)但没有结果
jQuery('#next-div').mouseenter(function() {
    setInterval(function() {
        var interval = images.moving; //this function has an spped of animation of 400 each transaction
    }, 400); 
}).mouseleave(function(){
    clearInterval(interval);
});