2013-04-02 193 views
0

我有一个JavaScript函数,我使用jQuery和jquery-timing,循环通过ul图像和文本更改不透明度。悬停启动/停止javascript功能

function gridautomate() { 

griditem.repeat().each($).find("img").animate({"opacity" : "1"},500, $).wait(7000).wait(noHover).animate({"opacity" : ".5"}, 500, $); 
griditem.repeat().each($).find(".quote").animate({"opacity" : "1"},500, $).wait(7000).wait(noHover).animate({"opacity" : "0"}, 500, $); 

};

我有另一个功能,改变也一样,但悬停。

function gridanimate() { 

griditem.hover(

    function(){ 
    $(this).find("img").animate({"opacity" : "1"},0); 
    $(this).find(".quote").animate({"opacity" : "1"},0); 
    }, 

    function(){ 
    $(this).find("img").animate({"opacity" : ".5"},0); 
    $(this).find(".quote").animate({"opacity" : "0"},0); 
    gridautomate(); 
    } 

); 

}

我想什么做的是切换开始悬停即1号功能上悬停停止并开始悬停了。无法弄清楚。

回答

0

我不理解这个问题。虽然你可以看看到stop()方法stop()

$('#hoverme-stop-2').hover(function() { 
  $(this).find('img').stop(true, true).fadeOut(); 
}, function() { 
  $(this).find('img').stop(true, true).fadeIn(); 
}); 
+0

这里你可以看到一个例子[链接](http://thesrpr.com/jvs)我希望动画循环停止,当一个鼠标悬停在某个图像。我试过了。没有骰子 – thesrpr