码迷,mamicode.com
首页 > 其他好文 > 详细

导航条钢琴效果

时间:2017-06-09 14:08:28      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:java   absolute   utf-8   ack   over   func   div   cti   round   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        ul{  overflow: hidden;}
        ul li{
            list-style: none;
            float: left;
            width: 90px;
            position: relative;
            display: inline-block;
            -webkit-transition: all .2s cubic-bezier(.4,0,1,1);
            transition: all .2s cubic-bezier(.4,0,1,1);
        }
        ul li a{
            position: relative;
            color: #333;
            text-decoration: none;
            text-align: center;
            line-height: 70px;
            font-size: 14px;
            display: block;
            z-index: 100;
            /*background: #9c0;*/
        }
       li:nth-child(1)::after {
            background: #b9d329;
        }
        li:nth-child(2)::after {
        background: #c0ebf7
        }
        li:nth-child(3)::after {
            background: #b3aff7
        }
        li:nth-child(4)::after {
            background: #f7c2c7
        }
        li:nth-child(5)::after {
            background: #dbf737
        }
        li:nth-child(6)::after {
            background: #ddc9f7
        }
        li:nth-child(7)::after {
            background: #acf7e7
        }
        li:nth-child(8)::after {
            background: #f7dfa4
        }
        li::after {
            content: "";
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 70px;
            top: 66px;
            -webkit-transition: .2s all ease-in-out;
            transition: .2s all ease-in-out;
            z-index: 1;
        }
        li.on::after{
            top:0;
            left:0;
        }
    </style>
</head>
<body>
<nav>
    <ul>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">首页</a></li>
    </ul>
</nav>
<script src="jquery-1.9.1.min.js"></script>
<script>
    $(function(){
        $(ul li).mouseover(function(){
            $(this).addClass(on)
        });
        $(ul li).mouseout(function(){
            $(this).removeClass(on)
        });
    })
</script>
</body>
</html>

 

导航条钢琴效果

标签:java   absolute   utf-8   ack   over   func   div   cti   round   

原文地址:http://www.cnblogs.com/minty/p/6971563.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!