gpt4 book ai didi

html - CSS3 跳跃位置

转载 作者:行者123 更新时间:2023-11-28 03:44:02 25 4
gpt4 key购买 nike

所以我使用这段代码实现了 CSS3 过渡以在屏幕上滚动宽幅图像

    animation-name:scrolling;
animation-duration: 20s;
animation-iteration-count: infinite;
animation-timing-function: linear;

@keyframes scrolling
{
0% { background-position: 0% 0%; }
100% { background-position: -2000px 0%; }
}

工作正常,但 20 秒后它跳回开头,有没有人知道我如何连续滚动它而不在 20 秒后跳回开头。如果我调整持续时间,这只会减慢滚动速度,然后在持续时间过后跳转。

您还知道如何使用悬停事件暂停动画吗?

谢谢

最佳答案

只需在中间添加另一个具有完整位置的关键帧(假设您希望 bg 回到它原来的位置,如果不只是将其设置为 -4000px)

 @keyframes scrolling
{
0% { background-position: 0% 0%; }
50% { background-position: -2000px 0%; }
100% { background-position: 0% 0%; }
}

应该可以解决这个问题 :)

关于html - CSS3 跳跃位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8091098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com