Skip to content

camerican/clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Clock

This sample code implements both a digital and analog clock in JavaScript utilizing the native setInterval and Date functions. jQuery is utilized for easy DOM selection and css transforms allow for the rotating clock hands.

This implementation only looks up the date once and then increments it every second, which means it is vulnerable to falling out of sync over time.

To setup an analog clock, simply declare the DOM container with the clock and analog classes:

<div id="analog_clock" class="clock analog"></div>

and then run the initializeHands function on that element:

initializeHands($("#analog_clock"),"data-value");

About

JavaScript Clock Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published