Skip to content

Instantly share code, notes, and snippets.

@zgchurch
Created March 17, 2011 16:27
Show Gist options
  • Save zgchurch/874620 to your computer and use it in GitHub Desktop.
Save zgchurch/874620 to your computer and use it in GitHub Desktop.
countdown timer; display fullscreen for speakers at conferences
<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