겉으로보기에는 간단한 문제를 해결하는 방법에 대해서는 잘 모릅니다. 앨범 커버 위로 마우스를 가져 가면 fadesIn (i) 아이콘 위로 마우스를 가져 가면 툴팁이 나타나지만 12 초 후에는 페이드 아웃 상태를 유지하지 않습니다. 어떻게하면 (i) 아이콘 위로 마우스를 가져 가면 아이콘 위에 머무르고 마우스가 아이콘을 떠날 때 fadsOut를 누르면 툴팁이 유지된다는 것을 어떻게 수정할 수 있습니까? 여기Jquery 마우스 이벤트
예 : http://www.midnightlisteners.com는
내 코드 :
// (i) Icon
$(".play, .more-info").mouseenter(function(){
clearTimeout($(this).data('timeoutIds'));
$(this).next(".more-info").fadeIn(600);
}).mouseleave(function(){
var someElement = $(this);
var timeoutIds = setTimeout(function(){
someElement.next(".more-info").fadeOut('150');
}, 1200); // giving a shorter time will reduce the fadeout effect
//set the timeoutId, allowing us to clear this trigger if the mouse comes back over
someElement.data('timeoutIds', timeoutIds);
});
// 툴팁
$(".more-info").mouseenter(function(){
clearTimeout($(this).data('timeoutId'));
$(this).find(".the-tooltip").fadeIn('150');
}).mouseleave(function(){
var someElement = $(this);
var timeoutId = setTimeout(function(){
someElement.find(".the-tooltip").fadeOut('150');
}, 1200);
//set the timeoutId, allowing us to clear this trigger if the mouse comes back over
someElement.data('timeoutId', timeoutId);
});
코드 검토에서 더 잘 맞을 수 있습니다. http://codereview.stackexchange.com/ – calvinf
@calvinf : Code Review SE는 작동 코드 전용입니다. 디버깅/도움이되는 질문 인 것 같습니다. – palacsint
@palacsint : 좋습니다. 좋은 정보입니다. – calvinf