'Ticker doesn't loop straight away at end
Code is below - I'm trying to get this to loop smoothly from the last headline - currently there is a gap and I can't figure out how to loop the headlines without it :/. The current functionality is good, but the gap at the end of the 4 headlines (NB - eventually there will be many more headlines) is really bugging me. Any help would be awesome
<style>
.box{
width: 80%;
}
* {
box-sizing: border-box;
}
@-webkit-keyframes ticker {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
100% {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
@keyframes ticker {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
100% {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
.ticker-wrap {
position: relative;
left: 0;
width: 100%;
overflow: hidden;
height: 3rem;
background-color: #000;
box-sizing: content-box;
}
.ticker-wrap .ticker {
display: inline-block;
height: 3rem;
line-height: 3rem;
white-space: nowrap;
padding-right: 10%;
box-sizing: content-box;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: ticker;
animation-name: ticker;
-webkit-animation-duration: 25s;
animation-duration: 25s;
}
.ticker-wrap .ticker__item {
display: inline-block;
padding: 0 2rem;
font-size: 2rem;
color: white;
}
</style>
<div class="rt-container">
<div class="col-rt-12">
<div class="Scriptcontent">
<div class="ticker-wrap">
<div class="ticker">
<div class="ticker__item"><h2></h2></div>
<div class="ticker__item"><h2>Massi out in FIA Race Director Shake-up</h2></div>
<div class="ticker__item"></div><div class="ticker__item"><h2>Ferrari Unveil Bold Design For 2022 Car.</h2></div>
<div class="ticker__item"></div><div class="ticker__item"><h2>Sprint Races Cut From 6 to 3 Due to Cost Cap Dispute.</h2></div>
<div class="ticker__item"></div><div class="ticker__item"><h2>Szafnauer named Alpine Team Principal as Rossi confirms new structure.</h2></div>
</div>
</div>
</div>
</div>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
