弹性伸缩展开工具菜单栏 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>
相关推荐
lsx2024061 分钟前
SOAP Envelope 元素
开发语言
范范@3 分钟前
day2-python基础语法
开发语言·python
qq_2518364573 分钟前
基于java 私厨美食共享平台系统设计与实现(有源码)
java·开发语言·美食
杜子不疼.5 分钟前
【C++ 在线五子棋对战】 - 工具类模块实现
开发语言·c++
夏至春来-美美12 分钟前
python 使用pytest的ini配置
开发语言·python·pytest
ZC跨境爬虫12 分钟前
跟着 MDN 学 HTML day_41:(DOMParser 接口详解)
前端·javascript·ui·html·音视频
geovindu17 分钟前
python: Mutex Pattern
开发语言·python·设计模式·互斥锁模式
永远自我17 分钟前
matlab对c语言模块进行仿真
c语言·开发语言
threelab19 分钟前
Three.js 概率统计可视化 | 三维可视化 / AI 提示词
开发语言·javascript·人工智能
m0_3722570223 分钟前
RRF和Cross-Encoder rerank怎么实现
开发语言·windows·python