使用css animation对两段文字添加上下无效滚动效果

复制代码
<div className={style.invite}>
    <img src={inviteIcon} />
    <div className={style.invite_content_box}>
        <div className={`${style.invite_content_box_list}`}>
            <div className={`${style.item} ${style.item_1}`} onClick={handleJumpInvite}>
                邀请好友注册,享 <span>50</span> 条消息数
            </div>
            <div className={`${style.item} ${style.item_2}`}>新注册用户,免费体验三天</div>
            <div className={`${style.item} ${style.item_3}`} onClick={handleJumpInvite}>
                邀请好友注册,享 <span>50</span> 条消息数
            </div>
        </div>
    </div>
</div>



.invite {
    background: rgba(236, 7, 135, 0.30);
    height: 32px;
    line-height: 32px;
    overflow: hidden;
    margin-top: 12px;
    border-radius: 16px;

    > img {
        margin-right: 4px;
        margin-left: 8px;
    }

    .invite_content_box {
        margin-top: 48px;
        width: 208px;

        .invite_content_box_list {
            height: 72px;
            position: relative;
            animation: moreContentScroll 6s ease-out infinite;
            animation-delay: 2s;

            .item {
                position: absolute;
                width: 100%;
                height: 24px;
                line-height: 24px;

                color: #FFF;
                font-size: 14px;
                font-style: normal;
                font-weight: 400;
            }

            .item_1 {
                top: 0;
            }

            .item_2 {
                top: 24px;
            }

            .item_3 {
                top: 48px;
            }
        }
    }
}


@keyframes moreContentScroll{
    0% {
        transform: translateY(0);
    }
    5% {
        transform: translateY(-24px);
    }
    50% {
        transform: translateY(-24px);
    }
    55% {
        transform: translateY(-48px);
    }
    100% {
        transform: translateY(-48px);
    }
}

参考如下网址

c摄图网-正版高清图片免费下载_商用设计素材图库

相关推荐
码路飞7 分钟前
GPT-5.3 Instant 终于学会好好说话了,顺手对比了下同天发布的 Gemini 3.1 Flash-Lite
java·javascript
Lee川8 分钟前
从回调地狱到同步之美:JavaScript异步编程的演进之路
javascript·面试
Lee川9 分钟前
从零构建AI对话应用:Vite脚手架搭建与API密钥安全实践
前端·程序员
进击的尘埃9 分钟前
WebSocket 长连接方案设计:从心跳保活到断线重连的生产级实践
javascript
允许部分打工人先富起来10 分钟前
在node项目中执行python脚本
前端·python·node.js
钟智强11 分钟前
Flutter引擎Android平台JNI层未验证指针转换漏洞
前端
骑着小黑马15 分钟前
Electron + Vue3 + AI 做了一个新闻生成器:从 0 到 1 的完整实战记录
前端·人工智能
Sailing17 分钟前
LLM 调用从 60s 卡死降到 3s!彻底绕过 tiktoken 网络阻塞(LangChain.js 必看)
前端·langchain·llm
洋洋技术笔记17 分钟前
计算属性与侦听器
前端·vue.js
用户8144869581118 分钟前
“马上”有惊喜:在 Rokid 灵珠平台上构建 FPS 级 AR 红包雷达应用
前端