2010-06-15 12 views
1

다음과 같은 jQuery 스크립트를 사용하여 롤오버했을 때 주황색 투명 호버 효과로 이미지를 덮어 씁니다. 어떻게 (페이드로?) 그렇게이 스크립트에서 아웃 애니메이션 것입니다해야합니까이미지 호버 애니메이션 처리

$(document).ready(function() { 

    $('#gallery a').bind('mouseover', function(){ 
     $(this).parent('li').css({position:'relative'}); 
     var img = $(this).children('img'); 
     $('<div />').text(' ').css({ 
      'height': img.height(), 
      'width': img.width(), 
      'background-color': 'orange', 
      'position': 'absolute', 
      'top': 0, 
      'left': 0, 
      'opacity': 0.5 
     }).bind('mouseout', function(){ 
      $(this).remove(); 
     }).insertAfter(this); 
    }); 

}); 

답변

0

시도 ..

$(document).ready(function() { 

    $('#gallery a').bind('mouseover', function(){ 
     $(this).parent('li').css({position:'relative'}); 
     var img = $(this).children('img'); 
     $('<div />').text(' ').css({ 
      'height': img.height(), 
      'width': img.width(), 
      'background-color': 'orange', 
      'position': 'absolute', 
      'top': 0, 
      'left': 0, 
      'opacity': 0.5 
     }).bind('mouseout', function(){ 
      $(this).fadeOut(function(){ $(this).remove(); }); // <--- added fadeout() 
     }).insertAfter(this).fadein(); // <--- added fadeIn() 
    }); 

}); 
+0

멋진, 감사합니다! 제대로 페이드 아웃하는 것처럼 보이지만 처음에는 롤오버에서 페이드 인하지 않습니다. – goddamnyouryan