jQuery打字机小练习

xml 复制代码
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>打字机</title>
    <style>
        div{
            width: 80px;
            height: 80px;
            line-height: 80px;
            text-align: center;
            background: red;
            color:#a7b5bc;
            margin: 10px;
            border-radius: 80px;


        }
    </style>
    <script src="../jquery-1.8.2.js"></script>
    <script>
        $(function(){
            //利用递归的思想来做打字机
            $('button:first').on('click',function(){
                $('div:first').slideDown(1000,function test(){
                    $(this).next().slideDown(1000,test)
                })
            })
            $('button:last').on('click',function(){
                $('div:last').slideUp(1000,function test(){
                    $(this).prev().slideUp(1000,test);
                })
            })
        })
    </script>
</head>
<body>
<div>一</div>
<div>二</div>
<div>三</div>
<div>四</div>
<div>五</div>
<div>六</div>
<div>七</div>
    <button >显示</button>
    <button>隐藏</button>
</body>
</html>
相关推荐
陈随易33 分钟前
Vue 编译器换掉 source map,快了三四成
前端·后端·程序员
一条大祥脚1 小时前
TVM 的前世今生:从深度学习编译器到 AI 基础设施
人工智能·深度学习·tvm
ZhengEnCi2 小时前
12 种高级 UI 交互效果及对应 AI 提示词:从按压回弹到底部抽屉的物理感教学
前端·css·交互设计
IT_陈寒5 小时前
Redis大key删除为什么会导致服务卡顿?我的线上事故复盘
前端·人工智能·后端
AI源码5 小时前
基于深度学习的音乐风格分类系统
人工智能·深度学习
用户2705077725245 小时前
MCP 最小 Server 实测:3 个 JSON-RPC 报错与修法
前端
用户499335025075 小时前
一人VIP账号多人共用:Web 代理里的会话共享怎么实现
前端
用户老李5 小时前
无线电自学教程 05:第一台收音机——从矿石机到 SDR
前端
IPIPD5 小时前
Node.js请求遇到503怎么重试?先解析Retry-After,再做有上限退避
前端
葡萄城技术团队5 小时前
dsh-spreadjs-editor 的集成链路:把 SpreadJS Designer 嵌进 Agent 工作台
前端