弹性伸缩展开工具菜单栏 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>
相关推荐
阿正的梦工坊2 分钟前
JavaScript 闭包 × C++ 类比:彻底搞懂闭包
开发语言·javascript·c++
赵优秀一一7 分钟前
SQLAlchemy学习记录
开发语言·数据库·python
无限进步_14 分钟前
【C++】寻找字符串中第一个只出现一次的字符
开发语言·c++·ide·windows·git·github·visual studio
孬甭_25 分钟前
字符函数及字符串函数
c语言·开发语言
摇滚侠33 分钟前
Java 进阶教程,全面剖析 Java 多线程编程
java·开发语言
KevinCyao40 分钟前
php彩信接口代码示例:PHP使用cURL调用彩信网关发送图文消息
android·开发语言·php
装疯迷窍_A44 分钟前
以举证方位线生成工具为例,分享如何在Arcgis中创建Python工具箱(含源码)
开发语言·python·arcgis·变更调查·举证照片
网域小星球1 小时前
C 语言从 0 入门(二十五)|位运算与位段:底层开发、嵌入式核心
c语言·开发语言
Gofarlic_OMS1 小时前
ENOVIA基于Token的许可证消费模式分析与分点策略
java·大数据·开发语言·人工智能·制造
XY_墨莲伊1 小时前
【实战项目】基于B/S结构Flask+Folium技术的出租车轨迹可视化分析系统(文末含完整源代码)
开发语言·后端·python·算法·机器学习·flask