js+css实现九宫格图标菜单展开切换动画效果代码

代码语言:html

所属分类:菜单导航

代码描述:js+css实现九宫格图标菜单展开切换动画效果代码

代码标签: js css 九宫格 图标 菜单 展开 切换 动画

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

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
    * {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #171b22
}

.container {
    position: relative;
    width: 70px;
    height: 70px;
    background-color: #212532;
    border-radius: 8px;
    cursor: pointer;
    transition: all .5s;
    display: flex;
    justify-content: center;
    align-items: center;
    transition-delay: .8s
}

.container.active {
    width: 300px;
    height: 300px;
    transition-delay: 0s
}

.container span {
    position: absolute;
    width: 7px;
    height: 7px;
    background-color: #fff;
    border-radius: 50%;
    transition: .5s;
    transform: translate(calc(12px * var(--x)),calc(12px * var(--y)));
    transition-delay: calc(0.1s * var(--i))
}

.container.active span {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background-color: #333849;
    transform: translate(calc(100px * var(--x)),calc(100px * var(--y)))
}

.container span ion-icon {
    transition: .5s;
    font-size: 0
}

.container.active span ion-icon {
    font-size: 2.2em;
    color: #fff
}

.container.active span:hover ion-icon {
    color: #2dfc52
}

</style>
</head>

<body>
    <div class="container">
        <span style="--i:0;--x:-1;--y:0;"><ion-icon name="airplane.........完整代码请登录后点击上方下载按钮下载查看

网友评论0