每种html行或列颜色内的文本将一一更改

时间:2018-10-11 09:57:44

标签: javascript jquery html css

我需要一个帮助,允许10到21之间的数字将字体颜色一一更改为白色并继续循环播放。就像当我们在电梯内时一样-当它到达该楼层时,它会保持发光的楼层编号。

.grid {
    max-width: var(--wrapper);
    display: grid;
    grid-template-columns: repeat(var(--noOfColumns), 1fr);
    grid-auto-flow: dense;
    /* If the content is taller then the box will grow to fit. This is only going to work if the column value is 1fr*/
    grid-auto-rows: var(--rh);
    grid-row-gap: var(--gutter);
    margin: var(--gutter);
    background-color: #555e65;
}
<div class="grid">
    <div >10</div>
    <div>14</div>
    <div >18</div>
    <div>17</div>
    <div>18</div>
    <div>19</div>
    <div >20</div>
    <div>21</div>

1 个答案:

答案 0 :(得分:1)

.grid {
  max-width: var(--wrapper);
  display: grid;
  grid-template-columns: repeat(var(--noOfColumns), 1fr);
  grid-auto-flow: dense;
  /* If the content is taller then the box will grow to fit. This is only going to work if the column value is 1fr*/
  grid-auto-rows: var(--rh);
  grid-row-gap: var(--gutter);
  margin: var(--gutter);
  background-color: #555e65;
}

@keyframes changeColor {
 from{color:red}
 to{color:red};
}

.animate {
  color: blue;
  transition: color .3s ease;
  animation: changeColor 10s;
}

.animate:nth-child(1) {
  animation-delay: .01s;
}

.animate:nth-child(2) {
  animation-delay: 10s;
}

.animate:nth-child(3) {
  animation-delay: 20s;
}
.animate:nth-child(4) {
  animation-delay: 30s;
}

.animate:nth-child(5) {
  animation-delay: 40s;
}

.animate:nth-child(6) {
  animation-delay: 50s;
}
.animate:nth-child(7) {
  animation-delay: 60s;
}

.animate:nth-child(8) {
  animation-delay: 70s;
}

.animate:nth-child(9) {
  animation-delay: 80s;
}
<div class="grid">
  <div class="animate gr">10</div>
  <div class="animate">14</div>
  <div class="animate">18</div>
  <div class="animate">17</div>
  <div class="animate">18</div>
  <div class="animate">19</div>
  <div class="animate">20</div>
  <div class="animate">21</div>
</div>