2012-06-05 8 views
0

나는 메뉴 슬라이드 쇼를 조정하고 메뉴의 4 개 항목 각각에 대해 아래에 표시된 내 코드 부분을 가지고 있습니다. 커서를 주어진 메뉴 항목 위로 이동하면 해당 div가 화면에 표시됩니다. 또한 시간 제한을 추가하여 한 메뉴 항목에서 다른 메뉴 항목으로 신속하게 이동하면 한 div에서 다른 div로 신속하게 전환하지 않습니다. 지금 정확히 원하는대로 작동하도록하는 질문은 입니다. 예를 들어 커서가 해당 메뉴 항목으로 전환하기 전에 예를 들어 200 밀리 초 후에 주어진 메뉴 항목 위에 여전히 커서가 있는지 확인하는 방법은 무엇입니까? 모든 의견이나 도움을 주시면 감사하겠습니다. 감사. 이 같은jquery menu 슬라이드 쇼 호버 기능 확인

$("div#menu .reps").hover(function() { 
    window.clearTimeout(timeoutID); 
    timeoutID = window.setTimeout(hoverFunctionReps, 280); 
}); 

function hoverFunctionReps(){ 
    if(current_slide != "reps"){ 

     $(".arrow").animate({"left":"135px"}); 

     if(current_slide == "clients"){ 
      $(".clients_display").stop(true,true).fadeOut().hide(); 
      $(".reps_display").fadeIn().show(); 
      current_slide = "reps"; 
     } 
     else if(current_slide == "services"){ 
      $(".services_display").stop(true,true).fadeOut().hide(); 
      $(".reps_display").fadeIn().show(); 
      current_slide = "reps"; 
     } 
     else{ 
      $(".training_display").stop(true,true).fadeOut().hide(); 
      $(".reps_display").fadeIn().show(); 
      current_slide = "reps"; 
     } 
    } 
} 

답변

0

아마 뭔가 :

http://jsfiddle.net/lucuma/ZgNKG/

var에 timeoutID;

$(document).ready(function() { 
$("a").hover(function() { 
    window.clearTimeout(timeoutID); 
    $(this).data('hashover', '1'); 
    var that = this; 
    timeoutID=window.setTimeout(
     (function() { 
     hoverFunctionReps(that); 
     }), 280); 

}, function() { 
    $('span', this).hide(); 
    $(this).data('hashover', '0'); 
}); 

function hoverFunctionReps(me) { 
    if ($(me).data('hashover') == '1') { 
     $('span', me).show(); 
    } 
} 
});​ 
+0

코드에서 이것을 구현할 시간이 생겼습니다. 정말 고마워. 이것은 내가 전에 얻지 못했던 몇 가지 자바 스크립트 부분을 이해하는 데 도움이되었습니다. – fudge22it