JavaScript Control Complex Sprite Image as a car Configurator

I'm doing a personal proyect where the user can configurate their car online. The basis is simple: 3 buttons (Change Color - Change View - Lights On/Off) and the following sprite image:

Ford Sprite

As you can see, the user can choose between 3 colors, change the view and turn the lights on.

So far so good, the problem is making this to reality, this is what I've got so far:

$(document).ready(function(){
    $("#color").click(function(){
        $('#box').toggleClass('white-front-off');
    });
    $("#view").click(function(){
        $('#box').toggleClass('red-back-off');
    });
    $("#lights").click(function(){
        $('#box').toggleClass('red-front-on');
    });
});
#box{
  width: 113px;
  height: 85px;
  background-image: url(https://i.stack.imgur.com/WNsgN.jpg);
}

.red-front-off {
  background-position: 0px 0px;
}

.red-back-off {
  background-position: -226px 0px;
}

.red-front-on {
  background-position: -113px 0px;
}

.red-back-on {
  background-position: -339px 0px;
}

.white-front-off {
  background-position: 0px -85px;
}

.white-back-off {
  background-position: -226px -85px;
}

.white-front-on {
  background-position: -113px -85px;
}

.white-back-on {
  background-position: -339px -85px;
}

.black-front-off {
  background-position: 0px -85px;
}

.black-back-off {
  background-position: -226px -85px;
}

.black-front-on {
  background-position: -113px -85px;
}

.black-back-on {
  background-position: -339px -85px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="box" class="red-front-off"></div>
<button id="color">Change Color</button>
<button id="view">Change View</button>
<button id="lights">Lights On/Off</button>
Answer:1

a simple question. I want to use CSS Zoom level to resize my Site oncklick. I want to catch the css zoom from "html" element. CSS html{zoom:1} JavaScript function zoomIn(){ altzoom = document....

a simple question. I want to use CSS Zoom level to resize my Site oncklick. I want to catch the css zoom from "html" element. CSS html{zoom:1} JavaScript function zoomIn(){ altzoom = document....

  1. javascript zoom level of browser
  2. javascript zoom level detect
  3. javascript get zoom level
  4. javascript set zoom level
  5. javascript change zoom level
  6. javascript window zoom level
  7. javascript get zoom level of browser
  8. javascript check zoom level
  9. javascript set zoom level of browser
  10. javascript chrome zoom level
  11. javascript reset zoom level
  12. javascript detect zoom level browser
  13. javascript determine zoom level
  14. maps javascript zoom level
  15. arcgis javascript zoom levels
  16. javascript find zoom level
  17. javascript control zoom level
  18. javascript read zoom level
  19. javascript ie zoom level
  20. esri javascript zoom levels

I have done this to create number of columns based on the data my server returns back. I want to check if the data in the array matches the column name, if it does then return yes else return no. ...

I have done this to create number of columns based on the data my server returns back. I want to check if the data in the array matches the column name, if it does then return yes else return no. ...

  1. datatable rows add array

I am struggling with an excercise question and maybe you could help me. I have to set up a camera and cube with THREE.js. The cube should keep its initial ratio and the camera should look at the ...

I am struggling with an excercise question and maybe you could help me. I have to set up a camera and cube with THREE.js. The cube should keep its initial ratio and the camera should look at the ...

For the CMS page editor in Magento,i would like to change the formatting of the H tags in the tinyMce editor. I would like something like for H1 tag, it is in red, bold, font:36px. how would i go ...

For the CMS page editor in Magento,i would like to change the formatting of the H tags in the tinyMce editor. I would like something like for H1 tag, it is in red, bold, font:36px. how would i go ...