悬浮菜单弹出动画效果

代码语言:html

所属分类:菜单导航

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

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

    <title> - Mobile Menu</title>
    <style>
:root {
        --blue: #008EFA;
        --pink: #FF207A;
        --bg: #EEEEEE;
        --white: #FEFEFE;
    }
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100vh;
            background-color: var(--bg);


        }
        .main {
            display: flex;
            justify-content: center;
            align-items: flex-end;
            width: 300px;
            height: 200px;
            position: relative;
        }
        .menu {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 300px;
            height: 100px;
            padding: 30px;

            border-radius: 5px;
            box-shadow: 0 0 5px 1px rgba(0,0,0,.05);
            background-color: var(--white);
        }
        .menu__trigger {
            position: absolute;
            top: 50px;
            left: calc(50% - 50px);
            width: 100px;
            height: 100px;
            background-color: var(--blue);
            border: 10px solid var(--bg);
            border-radius: 50%;
            padding: 20px;
            cursor: pointer;
            transition: .35s ease;
        }
        .menu__base {
            width: 20px;
            height: 20px;
            object-fit: contain;
            opacity: .7;
        }
        .menu__item {
            position: absolute;
            width: 60px;
            height: 60px;
            top: 70px;
            padding: 20px;
            border-radius: 50%;


            background-color: var(--white);
            border: none;
            box-shadow: 0 0 5px 1px rgba(0,0,0,.05);
            z-index: -1000;
            opacity: 0;
        }
        .menu__item--0 {
            transition: .35s ease;
            left: calc(50% - 30px);
        }
        .menu__item--1 {
            transition: .35s ease .1s;
            left: calc(50% - 30px);
        }
        .menu__item--2 {
            transition: .35s ease .2s;
            right: calc(50% - 30px);
        }

        .is-rotate {
            transform: rotateZ(225deg);
            background-color: var(--pink);
        }
        .item-0 {
            top: 20px;
            left: calc(50% - 110px);
            opacity: 1;
        }
        .item-1 {
            top: -25px;
            left: calc(50% - 30px);
            opacity: 1;
        }
        .item-2 {
            top: 20px;
            right: calc(50% - 110px);
            opacity: 1;
        }

    </style>

</head>
<body translate="no">

    <div class="main">
        <div class="menu">
            <img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIxMnB4IiB2ZXJzaW9uPSIxLjEiIHZp%0D%0AZXdCb3g9IjAgMCAxOCAxMiIgd2lkdGg9IjE4cHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8y%0D%0AMDAwL3N2ZyIgeG1sbnM6c2tldGNoPSJodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0%0D%0AY2gvbnMiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48dGl0bGUv%0D%0APjxkZXNjLz48ZGVmcy8+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBpZD0iUGFn%0D%0AZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSI+PGcgZmlsbD0iIzAwMDAwMCIgaWQ9%0D%0AIkNvcmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC04Ny4wMDAwMDAsIC0zNDIuMDAwMDAwKSI+PGcg%0D%0AaWQ9Im1lbnUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDg3LjAwMDAwMCwgMzQyLjAwMDAwMCkiPjxw%0D%0AYXRoIGQ9Ik0wLDEyIEwxOCwxMiBMMTgsMTAgTDAsMTAgTDAsMTIgTDAsMTIgWiBNMCw3IEwxOCw3%0D%0AIEwxOCw1IEwwLDUgTDAsNyBMMCw3IFogTTAsMCBMMCwyIEwxOCwyIEwxOCwwIEwwLDAgTDAsMCBa%0D%0AIiBpZD0iU2hhcGUiLz48L2c+PC9nPjwvZz48L3N2Zz4=" class="menu__base">
            <img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQg%0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jAuMjczLTE2%0D%0AMC4yNzQgIEMzODQuNjU3LDEzNS44NTYsMzEyLjkwOSw2NC4xMDksMjI0LjM4NCw2NC4xMDl6Ii8+%0D%0APC9zdmc+" class="menu__base">
            <img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIw.........完整代码请登录后点击上方下载按钮下载查看

网友评论0