JSFiddle - React, Tailwind, and code Playground
by Kostya Tretyak
March 21, 2015
HTML
<div id="controller">
<div id="ticker">
<div class="tweet">
There is a very long string that does not fit in the parent html-elemen.
</div>
</div>
</div>
<div id="runner">
...
</div>
CSS
#controller {
box-sizing: border-box;
width: 240px;
overflow:hidden;
border: 1px solid red;
float: left;
}
#controller:hover #ticker {
-webkit-animation: move_eye 3s linear 0s 1 normal;
-webkit-animation-fill-mode: forwards; /* Chrome, Safari, Opera */
animation-fill-mode: forwards;
}
#ticker {
white-space: nowrap;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes move_eye {
from {top: 0px;}
to {
-ms-transform: translate(-100%,0); /* IE 9 */
-webkit-transform: translate(-100%,0); /* Safari */
transform: translate(-100%,0);
}
}
/* Standard syntax */
@keyframes move_eye {
from {top: 0px;}
to {
-ms-transform: translate(-100%,0); /* IE 9 */
-webkit-transform: translate(-100%,0); /* Safari */
transform: translate(-100%,0);
}
}
.tweet {
box-sizing: border-box;
display: inline-block;
padding: 5px 10px;
margin: 5px 2px;
height: 100%;
}
#runner {
height: 100%;
padding-top: 10px;
padding-bottom: 10px;
border: 1px solid green;
width: 280px;
}