A Pen by Nick Mkrtchyan on CodePen.
Created
April 11, 2014 04:48
-
-
Save anonymous/10441367 to your computer and use it in GitHub Desktop.
A Pen by Nick Mkrtchyan.
This file contains hidden or 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
<div class="clock"> | |
<div class="hours"></div><!-- | |
--><div class="minutes"></div><!-- | |
--><div class="seconds"></div><!-- | |
--><div class="twelvehr"></div> | |
</div> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> |
This file contains hidden or 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
var $document = $(document); | |
(function () { | |
var clock = function () { | |
clearTimeout(timer); | |
date = new Date(); | |
hours = date.getHours(); | |
minutes = date.getMinutes(); | |
seconds = date.getSeconds(); | |
dd = (hours >= 12) ? 'pm' : 'am'; | |
hours = (hours > 12) ? (hours - 12) : hours | |
var timer = setTimeout(clock, 1000); | |
$('.hours').html('<p>' + Math.floor(hours) + ':</p>'); | |
$('.minutes').html('<p>' + Math.floor(minutes) + ':</p>'); | |
$('.seconds').html('<p>' + Math.floor(seconds) + '</p>'); | |
$('.twelvehr').html('<p>' + dd + '</p>'); | |
}; | |
clock(); | |
})(); | |
(function () { | |
$document.bind('contextmenu', function (e) { | |
e.preventDefault(); | |
}); | |
})(); |
This file contains hidden or 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
@font-face { | |
font-family: 'Electrolize'; | |
font-style: normal; | |
font-weight: 400; | |
src: local('Electrolize'), local('Electrolize-Regular'), url(http://themes.googleusercontent.com/static/fonts/electrolize/v2/DDy9sgU2U7S4xAwH5thnJ4bN6UDyHWBl620a-IRfuBk.woff) format('woff'); | |
} | |
body { | |
background:lightyellow; | |
-webkit-user-select: none; | |
font-family: 'Electrolize'; | |
font-size:40px; | |
color:white; | |
} | |
.clock { | |
position:absolute; | |
top:30%;left:40%; | |
box-shadow:0 0 500px red; | |
background-color: #292929; | |
width:300px; | |
height:50px; | |
margin:auto; | |
padding:30px; | |
} | |
.clock div{ | |
margin-top:-40px; | |
display:inline-block; | |
width:25%; | |
height: 10%; | |
text-align: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment