Created
April 17, 2014 08:25
-
-
Save Largo/10964346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, body{ | |
height: 100%; | |
} | |
#clock { | |
font-size: 50px; | |
/* font-family: 'Helvetica, Arial'; | |
color: #3e3e3e; */ | |
} | |
.wrap { | |
/*background: #fff; | |
margin: 0 auto; | |
width: 300px; | |
text-align: center; | |
padding: 10px; */ | |
} | |
.wrap { | |
text-align: center; | |
} | |
@media (min-device-width: 768px) { | |
.outer-wrap { | |
display: -webkit-flex; | |
display: flex; | |
width: 100%; | |
height: 100%; | |
} | |
.wrap { | |
-webkit-align-self: center; | |
align-self: center; | |
width: 400px; | |
margin: 0 auto; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery.min.js"></script> | |
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" /> | |
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body onload="updateClock(); setInterval('updateClock()', 1000 )"> | |
<div class="outer-wrap"> | |
<div class="well wrap"> | |
<h1 id="clock"> </h1> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateClock ( ) | |
{ | |
var currentTime = new Date ( ); | |
var currentHours = currentTime.getHours ( ); | |
var currentMinutes = currentTime.getMinutes ( ); | |
var currentSeconds = currentTime.getSeconds ( ); | |
// Pad the minutes and seconds with leading zeros, if required | |
currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours; | |
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; | |
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds; | |
// Compose the string for display | |
var currentTimeString = currentHours + 'h' + " : " + (currentMinutes / 60 * 100 ).toFixed(0) + '%' + " : " + (currentSeconds / 60 * 100).toFixed(0) + '%'; | |
// Update the time display | |
document.getElementById("clock").firstChild.nodeValue = currentTimeString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment