JSFiddle - React, Tailwind, and code Playground

by rohanbhangui

HTML

<div class="content-right-panel-main-panel-feed">
    <div class="content-right-panel-main-panel-feed-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim a - (space)#DIRECTVInteractivo</div>
</div>

CSS

.marquee {
    -webkit-animation: marquee 10s linear infinite;
    -moz-animation: marquee 10s linear infinite;
    -ms-animation: marquee 10s linear infinite;
    -o-animation: marquee 10s linear infinite;
    animation: marquee 10s linear infinite;
}

.content-right-panel-main-panel-feed {
    height: 30px;
    vertical-align: middle;
    background: #0274AA;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    padding-top: 10px;
    padding: 10px 7px 0px 7px;
    margin: 0 5px;
    overflow: hidden;
    position: relative;
}
.content-right-panel-main-panel-feed-content {
    position: absolute;
    overflow: hidden;
    white-space: nowrap;
}

JavaScript

var prefixes = ["-webkit-","-moz-","-ms-","-o-",""];

var width = $('.content-right-panel-main-panel-feed-content').outerWidth();

	var keyframeRules = "";

	for (var i = 0; i < prefixes.length; i++) {
		keyframeRules += '@' + prefixes[i] + 'keyframes marquee {' +
		'    0% { left: 100%; }' +
		'    100% { left: -' + width + 'px; }' +
		'}';

		$(".marquee").css((prefixes[i] + "animation"), ("marquee " + 200 + "s linear infinite"));
	};

	$('head').append($('<style/>').html(keyframeRules));

	$('content-right-panel-main-panel-feed div').addClass('marquee');