开发者

jQuery Dim or change other list items on hover

How could I go about changing color on hover and at the same time dim the rest to a different color and/or opacity.

A simple three list 开发者_如何转开发items enclosed within it's unordered list.

These list items change color on hover.

Code:

.right-side .headlines li a,.right-side .headlines li{font-size:36px;color:#999}
.right-side .headlines li a:hover{color:#0976ca}

<ul class="headlines">
    <li>
        <a href="#">Headline 1</a>
    </li>
    <li>
        <a href="#">Headline 2</a>
    </li>
    <li>
        <a href="#">Headline 3</a>
    </li>           
</ul>

Thanks Guys


jsFiddle example

CSS:

.headlines a{
    font-size:36px;
    color:#999;
    transition: all 0.5s;
}
.headlines:hover a{            /* PARENT HOVER */
    opacity:0.4;               /* Dim all */
}    
.headlines       a:hover{      /* SINGLE HOVER */
    opacity: 1;                /* Max one */
    color:#0976ca;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜