动态弹出菜单效果

代码语言:html

所属分类:菜单导航

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

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

    <title> Menu Interaction</title>
    <style>
        body {
            width: 100%;
            height: 100vh;
            padding: 0;
            margin: 0;
            background-color: #9CB46D;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .widget {
            width: 288px;
            height: 200px;
            display: flex;
            justify-content: flex-end;
            border-radius: 10px;
            background-color: #FFF;
        }
        .widget.active .menu {
            width: 344px;
        }
        .widget.active .menu .toggle {
            right: 296px;
        }
        .widget.active .menu .toggle i {
            width: 8px;
            transition: width 400ms cubic-bezier(0.6, 0, 0.45, 0.99), transform 1000ms cubic-bezier(0.6, 0, 0.45, 0.99) 300ms, top 200ms cubic-bezier(0.6, 0, 0.45, 0.99) 200ms, bottom 200ms cubic-bezier(0.6, 0, 0.45, 0.99) 200ms;
        }
        .widget.active .menu .toggle i:first-of-type {
            top: 19px;
            transform: rotate(45deg) translate(-1px, -2px);
        }
        .widget.active .menu .toggle i:last-of-type {
            bottom: 19px;
            transform: rotate(-45deg) translate(-1px, 2px);
        }
        .widget.active .menu .list {
            visibility: visible;
            flex-direction: row-reverse;
        }
        .widget.active .menu .list li {
            transform: scale(1);
        }
        .widget .menu {
            width: 56px;
            height: 56px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: absolute;
            border-radius: 100px;
            background-color: #4C5042;
            transform: translate(28px, -50%);
            box-shadow: 0px 10px 30px -15px rgba(0, 0, 0, 0.7);
            transition: 650ms cubic-bezier(0.79, 0, 0.22, 1);
        }
        .widget .menu .toggle {
            width: 40px;
            height: 40px;
            right: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            position: absolute;
            border-radius: 100px;
            cursor: pointer;
            z-index: 100;
            background-color: #4C5042;
            transition: 600ms cubic-bezier(0.79, 0, 0.22, 1);
        }
        .widget .menu .toggle:hover {
            background-color: #3C4134;
        }
        .widget .menu .toggle i {
            width: 12px;
            height: 2px;
            position: absolute;
            display: flex;
            border-radius: 100px;
            bac.........完整代码请登录后点击上方下载按钮下载查看

网友评论0