2013-08-20 3 views
0

여기 내 실수를 찾는 데 몇 가지 문제가 있습니다. 디버깅 콘솔에서 "변수를 찾을 수 없습니다 : mouseover/mouseout." 그녀가 나에게 뭐라고 말하려고하는지 모르겠다. onmouseover/onmouseout 이벤트로 50 %의 투명성을 위해 div로 페이드하고 싶습니다.javascript 및 less css로 onMouseOver 및 onMouseOut 디버깅

<div id="right" class="" onMouseOver="javascript: mouseover(this);" onMouseOut="javascript: mouseout(this);"></div> 

<script type="text/javascript"> 
    function mouseover(this) { 
    this.setAttribute("class", "mouseover"); 
    } 

    function mouseout(this) { 
    this.setAttribute("class", ""); 
    } 
</script> 

lessCss 코드 :

#right { 
    position:fixed; 
    top:320px; 
    right:0px; 
    z-index:5; 
    height:200px; 
    width:30px; 
    background-image: url(images/right); 
    border-radius:5px; 
    background-color:fade(darken(@bg-color, 50%),50%); 
    cursor:pointer; 
} 
.mouseover { 
    background-color:darken(@bg-color, 50%); 
} 

답변

2

당신은 자바 스크립트 기능을 필요 없어요, CSS를 사용 선택 "가져가"

귀하의 사업부는 단순히 아이디로 "권리"가 필요합니다
#right { 
position:fixed; 
top:320px; 
right:0px; 
z-index:5; 
height:200px; 
width:30px; 
background-image: url(images/right); 
border-radius:5px; 
background-color:fade(darken(@bg-color, 50%),50%); 
cursor:pointer; 
} 
#right:hover { 
background-color:darken(@bg-color, 50%); 
} 

:

<div id="right"></div> 
+0

감사합니다. :디 – Reijo

관련 문제