2012-08-28 2 views
0

jQuery 함수에 대한 작업을하고 있습니다. mouseover 이벤트가 트리거되는 동안 작동하는 함수가 하나 있지만 마우스를 올려 놓는 동안 호출해서는 안된다는 요구가 있습니다. 매 5 초마다 호출해야하지만 couldn 이것을 달성하지 못합니다. 그 문제를 해결하는 방법?jquery 타이머 함수

내가 참조를 위해 스 니펫을 추가 한 ..

f.children(a.childSelector).each(function(h) { 
     jQuery(this).mouseover(function(i) { 
       var j = (a.reflect === true) ? 360 - (g * h) : g * h; 
      j = jQuery.roundabout_toFloat(j); 
      if (!jQuery.roundabout_isInFocus(f, j)) { 
       i.preventDefault(); 
       if (f.data("roundabout").animating === 0) { 
        f.roundabout_animateAngleToFocus(j) 
       } 
       return false 
      } 
     }) 
}) 

+0

뿐만 아니라 일부 HTML 코드를 제공, 우리는 문제를 재현 할 수 있도록 – ShaunOReilly

답변

0
var repeatFunction = setInterval(function(){ 
    //do something here 
}, 5000); //repeats after interval of 5 second (atleast) 
0

는 5 초마다

사용 setInterval(..) 전화 또는 더 많은 유연성을 위해 setTimeout(..)를 사용하여 기능을 모방한다. 같은

뭔가 :

f.children(a.childSelector).each(function(h) { 
     setInterval(function() { 
      var j = (a.reflect === true) ? 360 - (g * h) : g * h; 
      j = jQuery.roundabout_toFloat(j); 
      if (!jQuery.roundabout_isInFocus(f, j)) { 
       if (f.data("roundabout").animating === 0) { 
        f.roundabout_animateAngleToFocus(j) 
       } 
      } 
     },5000); 
    })