javascript - Force strips with % width to moves like in marquee without blank space -


i have 5 strips 20% of full width , different background-colors of each 1 , want animate in way: 1) strips moves left right, 2) after ^ animation want keep moving in "marquee" case want avoid blank space , glitches after repeats (something infinite horizontal scrolling).

i've tried use http://aamirafridi.com/jquery/jquery-marquee-plugin#examples plugin, it's doesn't work in case because of width , different background colors.

maybe there way use pure css3? here's sketch: http://jsfiddle.net/sbgrhtqv/

<div class="strips">     <div class="strip"></div>     <div class="strip"></div>     <div class="strip"></div>     <div class="strip"></div>     <div class="strip"></div> </div>  .strips {     width:100%;     -webkit-animation-name: slide;     -webkit-animation-duration: 4s;     -webkit-animation-iteration-count: infinite; }  .strip {     height: 5px;     width:20%;     float: left; } .strip:nth-child(1) {background: red;} .strip:nth-child(2) {background: purple;} .strip:nth-child(3) {background: grey;} .strip:nth-child(4) {background: green;} .strip:nth-child(5) {background: blue;}  @-webkit-keyframes slide {     0%{         -webkit-transform:translatex(-100%);     }     100%{         -webkit-transform:translatex(0);     } } 

do have solutions? i'll greatful :)

for animation infinite, you'll need duplicate strips because cannot disappear right , fill blank space on left @ same time. added container hide overflow , not infinite horizontal scroll:

#container {      position: relative;      overflow: hidden;      width: 100%; height: 5px;  }    .strips {      position: absolute; left: -100%; top: 0;      width: 200%; height: 100%;      -webkit-animation: slide 4s linear infinite;      -moz-animation:    slide 4s linear infinite;      animation:         slide 4s linear infinite;  }    .strip { height: 5px; width: 10%; float: left; }    .strip:nth-child(1), .strip:nth-child(6) { background: red;    }  .strip:nth-child(2), .strip:nth-child(7) { background: purple; }  .strip:nth-child(3), .strip:nth-child(8) { background: grey;   }  .strip:nth-child(4), .strip:nth-child(9) { background: green;  }  .strip:nth-child(5), .strip:nth-child(10){ background: blue;   }    @-webkit-keyframes slide {      0%   { -webkit-transform: translatex(0);   }      100% { -webkit-transform: translatex(50%); }  }  @-moz-keyframes slide {      0%   { -moz-transform: translatex(0);   }      100% { -moz-transform: translatex(50%); }  }  @keyframes slide {      0%   { transform: translatex(0);   }      100% { transform: translatex(50%); }  }
<div id="container">      <div class="strips">          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>          <div class="strip"></div>      </div>  </div>


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -