首页 > 其他 > 详细

导航条钢琴效果

时间:2017-06-09 13:46:20      阅读:374      评论:0      收藏:0      [点我收藏+]
<!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>

 

导航条钢琴效果

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!