gpt4 book ai didi

html - 选取框滚动不流畅,选取框需要 100% 平滑滚动

转载 作者:行者123 更新时间:2023-11-28 01:53:46 25 4
gpt4 key购买 nike

我正在使用从右侧到左侧的选取框滚动。下面的代码工作正常。但它滚动不流畅。 “Hover on me to stop”内容闪烁或闪烁。我需要一个 100% 平滑的卷轴用于下面的选取框。请帮我。没有javascript是否可行??

<marquee behavior='scroll' direction='left' scrollamount='3' onmouseover='this.stop()' onmouseout='this.start()'>Hover on me to stop</marquee>

最佳答案

如果您想尝试使用纯 CSS,那么这是最简单的方法。尽管您需要检查对旧浏览器的支持并添加供应商前缀。

.marquee-parent {
position: relative;
width: 100%;
overflow: hidden;
height: 30px;
}
.marquee-child {
display: block;
width: 147px;
/* width of your text div */
height: 30px;
/* height of your text div */
position: absolute;
animation: marquee 5s linear infinite; /* change 5s value to your desired speed */
}
.marquee-child:hover {
animation-play-state: paused;
cursor: pointer;
}
@keyframes marquee {
0% {
left: 100%;
}
100% {
left: -147px /* same as your text width */
}
}
<div class="marquee-parent">
<div class="marquee-child">
Hover on me to stop
</div>
</div>

关于html - 选取框滚动不流畅,选取框需要 100% 平滑滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18417056/

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