使用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摄图网-正版高清图片免费下载_商用设计素材图库

相关推荐
anOnion8 小时前
构建无障碍组件之Menu Button pattern
前端·html·交互设计
用户47949283569158 小时前
claude Fable用不了?把Gpt 5.5pro接到你的claude code里
前端·后端
JieE2128 小时前
LeetCode 101. 对称二叉树|JS 递归 + 迭代双解法,彻底搞懂镜像判断
javascript·算法
冬奇Lab11 小时前
AI Workflow 定义的四次演进:从 Markdown 到 JS 脚本,再到分布式多 Agent
javascript·人工智能·agent
zhangxingchao11 小时前
Kotlin常用的Flow 操作符整理
前端
IT_陈寒12 小时前
React的useState居然还有这种坑?我差点删库跑路
前端·人工智能·后端
Pedantic13 小时前
SwiftUI 手势笔记
前端·后端
橙子家14 小时前
浏览器缓存之【结构化数据库与缓存】: IndexedDB、Cache storage 和 Storage buckets
前端
user205855615181314 小时前
X6 中边悬浮置顶,规避 `mouseleave` 事件丢失问题
前端
李明卫杭州14 小时前
CSS aspect-ratio 属性完全指南
前端