I have never use css animations before, so I just want to know, is this the 'best' way to animate a Ticker? I 'best' in this case encompasses efficient and semantic use of html and css.
It's worth noting that I intend to add extra functionality to this, such as manual scrolling back and forth. Is this set up ok for extending with javascript or is something here too temperamental?
Basic functionality is, Tweets scroll from right to left. When you put your mouse on one the scrolling stops and the tweet expands, and the time posted appears.
JSFiddle to see it in action
HTML:
<span id="controller">
<span id="ticker">
<span id="tweet">test </span>
<span id="tweet">
<img src="http://goo.gl/NpDXFs"></img>
<div id="text">
<span id="username">@Something</span>
<span id="extra_info">3m</span>
<div id="content">content</div>
</div>
</span>
</span>
</span>
CSS:
#controller {
background-color: blue;
display: inline-block;
position: absolute;
width: 100%;
}
#controller:hover #ticker {
-webkit-animation-play-state: paused
}
#ticker {
-webkit-animation: move_eye 6s linear 0s infinite normal;
}
@-webkit-keyframes move_eye {
from {
margin-left:110%;
}
to {
margin-left:-50%;
}
90% {
}
}
#text{
display: inline-block;
}
#tweet {
box-sizing: border-box;
background-color: white;
display: inline-block;
position: relative;
border-radius:5px;
margin: 0px 1px;
padding: 0px 3px;
}
#tweet:hover {
font-size: 120%;
}
#tweet:hover #extra_info {
display: inline-block;
}
#tweet:hover img {
width: 40px;
height: 40px;
}
#extra_info {
display: none;
}
img{
width: 30px;
height: 30px;
}
overflow-x:hidden;
also onbody
. \$\endgroup\$