Skip to content

Commit

Permalink
color change mechnic added
Browse files Browse the repository at this point in the history
  • Loading branch information
onuralpArsln committed Jun 4, 2024
1 parent 92d3258 commit 281c679
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion carMaker/carMaker.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h6 class="card-subtitle mb-2 text-body-secondary"> You can create your cars in

<div class="previewWindow">

<div class="carBody hatch"> </div>
<div class="carBody hatch" id="carPreview"> </div>

</div>

Expand Down
8 changes: 7 additions & 1 deletion carMaker/carMaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ function getValues() {
// Add event listener to the button
document.getElementById('createNow').addEventListener('click', getValues);

var currentColor = NaN;
var lastColor = NaN;

function colorChange() {
lastColor = currentColor;
var color = document.getElementById("colorSelect").value;
console.log("color has change" + color);
currentColor = color;
console.log("current color: " + currentColor);
console.log("last color: " + lastColor);
document.getElementById("carPreview").style.backgroundColor = color;
}


Expand Down

0 comments on commit 281c679

Please sign in to comment.