div+css实现垂直q弹图标菜单悬浮展开效果代码

代码语言:html

所属分类:菜单导航

代码描述:div+css实现垂直q弹图标菜单悬浮展开效果代码

代码标签: div css 垂直 q弹 图标 菜单 悬浮 展开

下面为部分代码预览,完整代码请点击下载或在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">
        <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">
<style>
    * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.iconfont {
    font-size: 26px !important;
    color: #fff;
    line-height: 50px;
    text-align: center;
}

.menu-box {
    width: 60px;
    height: 400px;
    background-color: #22243a;
    border-radius: 30px;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, .3);
    /* 添加过渡 */
    transition: all .2s ease-out;
    overflow: hidden;
}


.menu-box:hover {
    width: 120px;
    border-radius: 60px;
}

/* hover时让文字出现 */
.menu-box:hover>ul>li p {
    display: block;
}

/* 表情盒子 */
.emotion-box {
    width: 100%;
    text-align: center;
    margin: 10px auto;
}

#emotion1,
#emotion2 {
    color: #fff;
    font-size: 32px !important;
    animation: jitter .3s linear forwards;
}

#emotion2 {
    display: none;
}

.menu-box:hover #emotion1 {
    display: none;
}

.menu-box:hover #emotion2 {
    display: block;
}

ul {
    width: 100%;
    height: 75%;
}

li {
    list-style: none;
}

li>a {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 20%;
    text-decoration: none;
    /* 禁止用户选中 */
    user-select: none;
}

li:hover {
    background-color: #343850;
    cursor: pointer;
}

li:hover .content,
li:hover i {
    color: #fff;
}

li:hover i {
    animation: jitter .3s linear forwards;
}

.content {
    display: none;
    padding-left: 5px;
    color: #fff;
    /* 设置文字不换行 */
    white-space: nowrap;
    transition: all .2s ease-out;
}

/* 抖动动画 */
@keyframes jitter {
    0% {
        /* 缩放1.2倍,顺时针旋转10° */
        transform: scale(1.2) rotate(10deg);
    }

    50% {
        transform: scale(0.8) rotate(-10.........完整代码请登录后点击上方下载按钮下载查看

网友评论0