【发布时间】:2015-07-27 15:05:40
【问题描述】:
我正在制作股票行情,进展顺利,但我的 CSS 有问题。
股票代码有一个选框,它会滚动整个但不能完成一个循环。股票代码必须是 2em 高(确实如此)但是由于股票列表非常广泛,它永远没有机会到达末尾,因此大多数股票永远不会出现。
我很确定它与 css 有关:动画:选框 10s 线性无限;因为选框每 10 秒就会缩短一次。我附上了一个 jsfiddle,所以任何慷慨的人都可以进行实验。
.box {
width: 100%;
display: block;
padding-top: 5px;
font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
.floatleft2 {
float:left;
display: block;
padding-top: 5px;
font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size: 12px;
}
.stockSymbolnew {
}
.stockWrapper {
height: 2em;
text-indent: -1000em;
display: block;
padding-top: 5px;
font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
.stockSymbol {
font-weight: 600;
}
.stockPrice {
font-weight: 600;
color: red;
}
.stockChange {
font-weight: 600;
color: green;
}
.stockTime {
font-weight: 600;
color: grey;
font-size: smaller;
}
h2 {
font-size: 1.5em;
}
p {
margin-bottom: 0.5em;
}
.symbol {
float: left;
margin-right: 0px;
}
.symbol .name {
display: block
}
.symbol.up {
background: #70DB70
}
.symbol.up .change {
color: green
}
.symbol.down {
background: #f7cdc2
}
.symbol.down .change {
color: red
}
#verticalScroller {
position: absolute;
width:268px;
height: 2em;
border: 0px solid red;
overflow: hidden;
}
#verticalScroller > div {
height: 2em;
position:absolute;
width:268px;
border: 0px solid blue;
overflow:hidden;
}
div.marquee > div > div > div:nth-child(odd) {
background: #eee;
}
div.marquee > div > div > div {
padding-right: 15px;
}
.container {
height: 2em;
margin: 1em auto;
overflow: hidden;
background: white;
position: relative;
box-sizing: border-box;
}
.marquee {
height: 2em;
top: 6em;
position: relative;
animation-name: example;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation: marquee 10s linear infinite;
}
.marquee:hover {
animation-play-state: paused;
}
@keyframes marquee {
0% {
top: 2em
}
100% {
top: -11em
}
}
https://jsfiddle.net/phbakdLe/1/
问候 山姆
【问题讨论】: