I'm working with a custom slider, I have many slide indicators. There should be an orange color line between 2 indicators e.g If I click on indicator 1 then there will be the line between indicators 1 and 2 and if I click indicator 2 then there will be line between 2 and 3 and so on. For this line, I'm using :after selector. CSS Code:
.carousel-indicators li:after{
    content: "";
    width: 20px;
    height: 3px;
    background: orange;
    top: 28%;
    left: 1%;
    position: absolute;
    display: inline-block;
}
HTML code:-
 <!-- Carousel Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
    </ol>
<!-- Carousel Indicators End -->
I've calculated that if we move from indicator 1 to nth indicator then I need to add a 6% margin in left. I want to do this with the help of jQuery i.e if I move from indicator 1 to nth then I'll add %6 in the previous margin-left (1+6 = 7%) similarly if I move from 2 to 3 then I'll add %6 in previous margin-left (7+6 = 13%) and so on. But here I need to get the previous margin-left so that I can perform some calculation/addition. How can I get :after selector margin-left? I tried the following code but it's giving me undefined.
$('.carousel-indicators li').click( function (){
        margLeft = $('.carousel-indicators li:after').css('margin-left');
        console.log(margLeft);
    });
and
$('.carousel-indicators li').click( function (){
        margLeft = $('.carousel-indicators li:after').css('marginLeft');
        console.log(margLeft);
    });
Bot are giving output as undefined.
 
    