Skip to content

Commit c8f5999

Browse files
author
Morgan Murrah
committed
Add negative red counter when score is negative :)
1 parent 4a240aa commit c8f5999

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

public/css/main.css

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
width: 100vw;
7272
align-content: center;
7373
}
74+
.negative {
75+
color: red !important;
76+
}
77+
7478
/*.question {*/
7579
/*height:100px;*/
7680
/*vertical-align: middle;*/

public/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
</div>
2727
<div class="collapse navbar-collapse" id="myNavbar">
2828
<ul class="nav navbar-nav">
29-
<!--<li><a href="https://github.com/ATL-WDI-Curriculum/projects/blob/master/project1.md">Project Specs</a></li>-->
30-
<li><a href="https://trello.com/b/FtyjyTlm/wdi-project-1-jeopardy-morgan-murrah">Trello (Archive)</a></li>
29+
<!-- <li><a href=""></a></li>-->
3130
</ul>
3231
<ul class="nav navbar-nav navbar-right">
3332
<!-- Background music -->

public/js/main.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,25 @@ function submit(a, b) {
4747
chaching.play();
4848
window.addprize = questions[window.currentQuestion].cashPrize;
4949
score = score + window.addprize;
50-
console.log(score);
5150
$('#score1').html(" $"+score);
51+
if (!Math.sign(score)){
52+
$('#score1').addClass( "negative" );
53+
} else {
54+
$('#score1').removeClass( "negative" );
55+
}
5256
}
5357
// Determine if incorrect answer was chosen and alert prize
5458
if ( selected !== questions[window.currentQuestion].correctAnswer ) {
5559
buzzer.play();
5660
window.subprize = questions[window.currentQuestion].cashPrize;
5761
score = score - window.subprize;
62+
console.log(score);
5863
$('#score1').html(" $"+score);
64+
if (Math.sign(score)){
65+
$('#score1').addClass( "negative" );
66+
} else {
67+
$('#score1').removeClass( "negative" );
68+
}
5969
}
6070
}
6171
// Get question info from array, prepare
@@ -88,7 +98,7 @@ $(function() {
8898
});
8999
});
90100
$("#myModal").on('hidden.bs.modal', function () {
91-
console.log('The modal is now hidden.');
101+
// console.log('The modal is now hidden.');
92102
});
93103
$('.modal-body input:checked').submit(function() {
94104
$('#myModal').modal('toggle');

0 commit comments

Comments
 (0)