Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Condition to show image with JavaScript and HTML

I need to replace the circles with images according to the status I have: currently

I have JSON with the statuses to determine the current status, and the function for checking the statuses:

// set tracker location 
$scope.setTrackerLocation = function() {
  if ($scope.orderStatus) {
    var w = $timeout(function() {
      var item = $('.tracker li:has(a.myflicker)');
      if (item) { // space between tracker box and window edge 
        var leftSpace = ($(window).width() - $('.borderBox').width()) / 2;
        var left = item.offset().left - leftSpace - item.width() / 12;
        $('.logoMove').css('left', left);
      }
      $timeout.cancel(w);
    }, 300);
  }
}
.tracker {
  margin-top: 30px;
}

.tracker ul {
  margin-top: 10px;
}

.tracker li {
  position: relative;
  width: 20%;
}

.tracker li::before {
  content: '';
  position: absolute;
  top: .9em;
  left: -40%;
  width: calc(100% - 2em);
  height: .2em;
  z-index: 0;
}

.tracker li a {
  width: 2em;
  height: 2em;
  text-align: center;
  line-height: 2em;
  border-radius: 1em;
  display: inline-block;
  position: elative;
}

.tracker li:first-child::before {
  display: none;
}

.tracker li>.triggerName {
  font-size: 16px;
  margin-top: 10px;
  font-weight: 700;
}

.logoMoveBox {
  position: relative;
  height: 75px;
  z-index: 9;
}

.logoMove {
  position: absolute;
  width: 150px;
  height: 150px;
  left: 0;
  transition: all 2s;
}

.motorcycle>.moto {
  width: 100%;
  height: 100%;
}

.logoMove>.motoLogo {
  width: 30px;
  height: 20px;
  position: absolute;
  top: 60px;
  left: 34px;
}

.trackerFooter {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 151px;
  transform: skewY(-5deg) translateY(35px);
  z-index: 9;
}

.trackerBox {
  overflow: hidden;
  position: relative;
}
<div class="" ng-if="businessInfo">
  <div class="">
    <div class="tracker">
      <div class="">
        <ul class="list-inline" role="tablist" start-time="{{startTime}}" order-status="{{orderStatus}}">
          <li class="pull-left" ng-repeat="orderStat in businessInfo" time-essential="{{orderStat.allowed_time_in_sec}}" ng-class="{'active': orderStat.sort==orderInfo.sort}">
            <a class="bar{{$index}}" ng-class="{'myflicker':orderInfo.status==orderStat.order_status}">
              <i ng-class="{'fa fa-check':orderInfo.sort>orderStat.sort}" aria-hidden="true"></i>
            </a>
            <div class="triggerName">
              {{orderStat.order_status_display}}
            </div>
          </li>
          <div class="clearfix"></div>
        </ul>
      </div>
    </div>
  </div>
</div>

I tried uploading the images via CSS and then checking the status but not working. How can I do it?

Comments