2013-03-02 2 views

답변

2

예, 순수한 CSS와 같은 효과를 얻을 수 있지만 신체를 변경하는 배경이 아니며 해당 메뉴의 마지막 목록 항목은 position: fixed이며 전체 페이지를 포함합니다.

QUICK DEMO

관련 HTML :

<ul class='menu'> 
    <li><a href='#'>contact</a></li> 
    <li><a href='#'>blog</a></li> 
    <!-- and so on, menu items --> 
    <li class='bg'></li> 
</ul> 

관련 CSS : 그 생각하지

.menu li { display: inline-block; } 
.menu li:first-child a { color: orange; } 
.menu li:nth-child(2) a { color: lime; } 
/* and so on for the other menu items */ 
.menu:hover li a { color: black; } 
.menu li a:hover { color: white; } 
.bg { 
    position: fixed; 
    z-index: -1; 
    top: 0; right: 0; bottom: 0; left: 0; 
    background: dimgrey; 
    transition: .5s; 
    pointer-events: none; 
} 
.menu li:first-child:hover ~ .bg { background: orange; } 
.menu li:nth-child(2):hover ~ .bg { background: lime; } 
/* and so on for the other menu items */ 
+0

아. 나는 그것을 줄 것이다. 고맙습니다. –