Skip to content

Commit

Permalink
Update garage.js
Browse files Browse the repository at this point in the history
00 > 0
  • Loading branch information
Pintta authored Apr 23, 2024
1 parent ec42699 commit c43ee35
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions html/js/garage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ let veh

$(document).on('click', '.garage-vehicle', function(e){
e.preventDefault();

$(".garage-homescreen").animate({
left: 30+"vh"
left: 30 + "vh"
}, 200);
$(".garage-detailscreen").animate({
left: 0+"vh"
left: 0 + "vh"
}, 200);

var Id = $(this).attr('id');
var VehData = $("#"+Id).data('VehicleData');
veh = VehData
Expand All @@ -26,12 +24,11 @@ $(document).on('click', '#track-vehicle', function(e){

$(document).on('click', '#return-button', function(e){
e.preventDefault();

$(".garage-homescreen").animate({
left: 00+"vh"
left: 0 + "vh"
}, 200);
$(".garage-detailscreen").animate({
left: -30+"vh"
left: -30 + "vh"
}, 200);
});

Expand All @@ -40,7 +37,6 @@ SetupGarageVehicles = function(Vehicles) {
if (Vehicles != null) {
$.each(Vehicles, function(i, vehicle){
var Element = '<div class="garage-vehicle" id="vehicle-'+i+'"><span class="garage-vehicle-firstletter">'+vehicle.brand.charAt(0)+'</span> <span class="garage-vehicle-name">'+vehicle.fullname+'</span> </div>';

$(".garage-vehicles").append(Element);
$("#vehicle-"+i).data('VehicleData', vehicle);
});
Expand All @@ -56,4 +52,4 @@ SetupDetails = function(data) {
$(".vehicle-fuel").find(".vehicle-answer").html(Math.ceil(data.fuel)+"%");
$(".vehicle-engine").find(".vehicle-answer").html(Math.ceil(data.engine / 10)+"%");
$(".vehicle-body").find(".vehicle-answer").html(Math.ceil(data.body / 10)+"%");
}
}

0 comments on commit c43ee35

Please sign in to comment.