2012-12-03 2 views
3

나는 내 jquery 지식에 약간 녹슨 같다. 웬일인지 녹색의 박스가 넘칠 때 내가 파란 상자를 퇴색시키기 위해 여기에없는 것을 알아낼 수 없다.Jquery Hover 불투명도, 내가 무엇을 놓치고 있습니까?

스크립트 :

$(document).ready(function() { 
    $(".hover-text").hover({ 
    $(".hover-hide").animate({ 
     opacity: 0.4, 
    }, 500); 
    });​ 

html로 :

<div class="hover-hide"> 
    <div class="hover-text"> 
     BLAH 
    </div> 
    </div> 

는 CSS :

.hover-hide{ 
    width:200px; 
    height:200px; 
    background-color:blue; 
    padding:30px; 
    } 
    .hover-text{ 
    color:white; 
    background-color:green; 
    padding:10px; 
    width:auto; 
    margin-top:20px; 
    }​​ 

정말 고마워요! :)

답변

5

.hover의 첫 번째 인수는 콜백 함수이며 $('.hover-text').hover(function(){이어야합니다. 피들 here.

1

.hover 전화 후에 function이 누락되었습니다. 또한, 끝에 닫는 대괄호와 괄호를 놓치고 당신의 .ready();

해야합니다 http://jsfiddle.net/TMZhJ/

: 여기
$(document).ready(function() {  

    $(".hover-text").hover(function() {  
     $(".hover-hide").animate({ opacity: 0.4, }, 500);  
    }); 

}); 

은 바이올린의
관련 문제