Skip to content

Instantly share code, notes, and snippets.

@unabridgedxcrpt
Forked from zgchurch/Countdown
Created January 21, 2013 22:50
Show Gist options
  • Save unabridgedxcrpt/4590260 to your computer and use it in GitHub Desktop.
Save unabridgedxcrpt/4590260 to your computer and use it in GitHub Desktop.
<style>
body {
background-color: black;
color: white;
font-family: sans-serif;
text-align: center;
}
#minutes {
font-size: 500px;
}
#seconds {
font-size: 100px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
$(function() {
// Change me!!!
var seconds = 25 * 60;
// Change me!!!
setInterval(function() {
seconds--;
if (seconds < (3 * 60))
{
$('body').css('background-color', 'red');
$('body').css('color', 'black');
}
else if (seconds < (5 * 60))
{
$('body').css('background-color', 'yellow');
$('body').css('color', 'black');
}
$("#minutes").html(Math.floor(seconds/60));
var secs = seconds % 60;
$("#seconds").html((secs < 10) ? '0'+secs : secs );
}, 1000);
});
</script>
<!-- Change the values here and in the javascript above -->
<div id='minutes'>25</div>
<div id='seconds'>00</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment