Animate Border Until Selected Element Sequenty
Can you please take a look at
this demo and let me know how I can add animation to borders properly so when use clicks on `a` the all previous borders get the `anime100` class after each other in a sequence
what is happening now is adding the `anime100` to all anime classes at the same time?
- <ul class="">
- <li>
- <div class="box">
- <div class="left"><a href="#">A</a></div>
- <div class="anime"></div>
- </div>
-
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">B</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">C</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">D</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">E</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">F</a></div>
- <div class="anime"></div>
- </div>
- </li>
- .anime{
- height:10px;
- width:0px;
- background:gold;
- transition: all 0.7s;
- }
- .anime100{
- width:250px;
- }
- $("a:eq( 1 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- });
- $("a:eq( 2 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- });
- $("a:eq( 3 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- $('.anime:eq( 2 )').addClass('anime100');
- });
- $("a:eq( 4 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- $('.anime:eq( 2 )').addClass('anime100');
- $('.anime:eq( 3 )').addClass('anime100');
- });
- $("a:eq( 5 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- $('.anime:eq( 2 )').addClass('anime100');
- $('.anime:eq( 3 )').addClass('anime100');
- $('.anime:eq( 4 )').addClass('anime100');
- });