滑动导航条特效

代码语言:html

所属分类:菜单导航

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title> - Navigation bar with circle flexible highlight POC</title>
<link rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css'>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            background: #E6E9ED;
            min-height: 100vh;
        }
        body nav.tab {
            position: relative;
            display: flex;
            align-items: stretch;
            width: 23rem;
            height: 4rem;
        }
        body nav.tab.moving .icon {
            pointer-events: none;
        }
        body nav.tab[data-selected="1"] .icon:nth-child(1), body nav.tab[data-selected="2"] .icon:nth-child(2), body nav.tab[data-selected="3"] .icon:nth-child(3) {
            top: -1.5rem;
            color: #2ABA66;
            font-size: 2rem;
            transition: 0.25s 0.375s;
            pointer-events: none;
        }
        body nav.tab[data-selected="1"] .icon:nth-child(1).initialised, body nav.tab[data-selected="2"] .icon:nth-child(2).initialised, body nav.tab[data-selected="3"] .icon:nth-child(3).initialised {
            -webkit-animation: hide 0.9s forwards;
            animation: hide 0.9s forwards;
        }
        body nav.tab[data-selected="1"] .bar .middle .side:first-child, body nav.tab[data-selected="3"] .bar .middle .side:last-child {
            flex-grow: 0;
        }
        body nav.tab .icons {
            position: absolute;
            z-index: 2;
            display: flex;
            justify-content: space-around;
            width: calc(100% - 2rem);
            padding: 0 1rem;
        }
        body nav.tab .icons .icon {
            position: relative;
            top: 0rem;
            width: 4rem;
            line-height: 4rem;
            font-size: 1.5rem;
            text-align: center;
            cursor: pointer;
            transition-delay: 0.1875s;
        }
        body nav.tab .icons .icon.initialised {
            -webkit-animation: hide2 0.375s;
            animation: hide2 0.375s;
        }
        body nav.tab .bar {
            z-index: 1;
            position: absolute;
            display: flex;
            align-items: stretch;
            -webkit-filter: drop-shadow(0 0 0.5rem rgba(0, 0, 0, 0.1)) drop-shadow(0 0 0.25rem rgba(0, 0, 0, 0.1));
            filter: drop-shadow(0 0 0.5rem rgba(0, 0, 0, 0.1)) drop-shadow(0 0 0.25rem rgba(0, 0, 0, 0.1));
            width: 100%;
            height: 100%;
        }
        body nav.tab .bar .cap {
            background: white;
            width: 1rem;
        }
        body nav.tab .bar .cap:first-child {
            border-bottom-left-radius: 1rem;
            border-top-left-radius: 0.5rem;
            box-shadow: 0.25rem 0 0 white;
        }
        body nav.tab .bar .cap:last-child {
            border-bottom-right-radius: 1rem;
            border-top-right-radius: 0.5rem;
            box-shadow: -0.25rem 0 0 white;
        }
        body nav.tab .bar .middle {
            flex-grow: 1;
            position: relative;
            display: flex;
        }
        body nav.tab .bar .middle .circle {
            position: relative;
            top: -1.75rem;
            width: 7rem;
            height: 5.75rem;
            background-image: url(".........完整代码请登录后点击上方下载按钮下载查看

网友评论0