zoukankan      html  css  js  c++  java
  • 导航条钢琴效果

    <!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>
    原创笔记
  • 相关阅读:
    [Leetcode 56] 55 Jump Game
    [Leetcode 57] 61 Rotate List
    [Leetcode 61] 73 Set Matrix Zeros
    [Leetcode 62] 74 Search a 2D Matrix
    [Leetcode 64] 78 Subsets
    [Leetcode 63] 77 Combinations
    [Leetcode 58] 63 Unique Path II
    python学习笔记第1章节 基础知识
    python学习笔记第2章节 分支,循环,还有条件
    visual studio 2008 试用版评估期已结束的解决方法(转载)
  • 原文地址:https://www.cnblogs.com/minty/p/6971563.html
Copyright © 2011-2022 走看看