div+css实现悬浮菜单点击伸缩展开效果代码

代码语言:html

所属分类:菜单导航

代码描述:div+css实现悬浮菜单点击伸缩展开效果代码

代码标签: div 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;
    min-height: 100vh;
    font-family: 'Poppins', sans-serif;
    background-image: linear-gradient(to left bottom, #d87a00, #f46246, #fa557c, #e75eaf, #bc74d7, #9487eb, #6197f4, #00a3f3, #00afed, #00b9e0, #00c0cf, #2ac6bc);
    /* 指定背景图像的大小 */
    background-size: 200%;
    /* 执行动画:动画名 时长 线性的 无限次播放 */
    animation: bgAnimation 30s linear infinite;
}

/* 定义动画 */
@keyframes bgAnimation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.navigation {
    position: relative;
    width: 60px;
    height: 60px;
    background-color: #ffffffa7;
    border-radius: 60px;
    transition: 0.5s;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    transition-delay: 0.5s;
    box-shadow: 0 10px 15px rgba(0, 0, 0, .05);
}

.navigation.active {
    width: 600px;
}

.navigation .toggleMenu {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: #fff;
    border-radius: 50%;
    transition: 0.5s;
    cursor: pointer;
    transition: 0.5s;
    transition-delay: 0.5s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.navigation.active .toggleMenu {
    background-color: #f46246;
    transition-delay: 0s;
    transform: translateY(60px);
    width: 30px;
    height: 30px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, .05);
}

.navigation .toggleMenu::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 3px;
    borde.........完整代码请登录后点击上方下载按钮下载查看

网友评论0