弹性伸缩展开工具菜单栏 js

css 复制代码
<style>
 *{
            margin:0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            background: #222;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
            min-height: 100vh;
        }
        .button{
            color: #fff;
            text-align: center;
            width:70px;
            height:70px;
            border-radius: 50%;
            background: #4c3ab0;
            position: relative;
        }
        .button::after{
            content: "+";
            position: absolute;
            inset:-6.5px;/*设置定位布局,上下左右各相距6.5px*/
            font-size: 3.5em;
        }
        .button.active{
            transform: rotate(45deg);
        }
        .icons.open{
            width:80%;
        }
        .icons{
            width:0;
            height:65px;
            list-style: none;
            padding:16px 10px 10px 50px;
            background: #ffffff;
            box-shadow: 1px 1px 1px #dcdcdc;
            border-radius: 2em;
            display: flex;
            justify-content: space-evenly;
            align-items: center;
        }
        .icons li  img{
            width:36px;

        }
        .icons li:nth-child(1){
            margin-left: 50px;
        }
        .icons li{
            width:80px;
           
        }
        .button{
            left:50%;
            margin-left: -35px;
            z-index:1;
        }
        .button,.icons{
            transition: all 1s cubic-bezier(0.85,-.57,0.37,2.99);
        }
        .icons{
            margin:-68px 0 0 44%;
            overflow: hidden;
            opacity: 0;
        }
        .button.active{
            left:60px;
            
        }
        .icons.open{
            margin:-68px 0 0 6%;
            opacity: 1;
        }
</style>
html 复制代码
<body>
    <div class="toolbar">
        <div class="button"></div>
        <ul class="icons">
            <li><img src="/iconBox/mine.png" alt=""></li>
            <li><img src="/iconBox/mine.png" alt=""></li>
            <li><img src="/iconBox/mine.png" alt=""></li>
            <li><img src="/iconBox/mine.png" alt=""></li>
            <li><img src="/iconBox/mine.png" alt=""></li>
        </ul>
    </div>
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js">
    </script>
    <script>
        $('.button').click(function(){
            $('.button').toggleClass('active')
            $('.icons').toggleClass('open')
        })
    </script>
</body>
相关推荐
安娜的信息安全说3 分钟前
深入浅出 MQTT:轻量级消息协议在物联网中的应用与实践
开发语言·物联网·mqtt
西洼工作室17 分钟前
高效管理搜索历史:Vue持久化实践
前端·javascript·vue.js
在坚持一下我可没意见22 分钟前
HTTP 协议基本格式与 Fiddler 抓包工具实战指南
java·开发语言·网络协议·tcp/ip·http·java-ee·fiddler
樱花开了几轉31 分钟前
element ui下拉框踩坑
开发语言·javascript·ui
报错小能手35 分钟前
C++笔记(面向对象)RTTI操作符
开发语言·c++·笔记
草明37 分钟前
Go 的 IO 多路复用
开发语言·后端·golang
故事不长丨1 小时前
【Java SpringBoot+Vue 实现视频文件上传与存储】
java·javascript·spring boot·vscode·后端·vue·intellij-idea
晟盾科技1 小时前
报表类系统后端API设计思路
开发语言·windows·php
AI纪元故事会1 小时前
冰泪与雨丝:一个AI的Python挽歌
开发语言·人工智能·python
我不是程序猿儿2 小时前
【C#】WinForms 控件句柄与 UI 刷新时机
开发语言·ui·c#