Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling div ticker

I want to build a scrolling ticker on the bottom of the screen that scrolls right to left.

What is the best way to approach this? I'm using reactjs, and I read that react doesn't play well with jQuery, and most of the examples I've found, use jQuery.

like image 923
clarity Avatar asked May 03 '26 08:05

clarity


2 Answers

You can create a side-scrolling effect purely with css. Here is a demo fiddle.

/* Make it a marquee */
.marquee {
    margin: 0 auto;
    white-space: nowrap;
    overflow: hidden;
}

.marquee span {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 5s linear infinite;
}

/* Make it move */
@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}
like image 89
Kyeotic Avatar answered May 05 '26 22:05

Kyeotic


Based on

Tyrsius

solution, I have modified a little bit the keyframe animation, so now it will stop for a while in the middle of the way, so user can read the content in a confortable way:

 @keyframes marquee {
0%   { transform: translate(0,0);
       font-style:italic;
       opacity:0;}
5%   { opacity:0;}
14%  { opacity:0.8;}
15%  { transform: translate(-46%, 0);
       opacity:1;
       font-style:normal;}
85%  { transform: translate(-54%, 0);
       opacity:1;
       font-style:normal;}
86%  { opacity:0.8;}
96%  { opacity:0;}  
100% { transform: translate(-100%, 0);
       opacity:0;}}
like image 44
Alberto S. Avatar answered May 05 '26 22:05

Alberto S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!