Jquery plugin to display time in analog clocks.
This is a very early stage of the plugin so there are still lots of planned improvements.
- Constructs basic analog clock
- Displays time based on the given time
- Support for multiple clocks
- Responsive
- Adjust time by interacting with clock
- jQuery
- Moment.js
$('#clock').analogClock(options);
Options can also be specified on the element itself. These options take precedence over the options defined in the previous declaration.
<div id="clock" data-init-time="5:20"></div>
Time to be displayed in the clock
Default: '0:00'
Time format to be used in processing time values. Refer to Moment.js parsing documentation for other formats you can use.
Default: 'H:mm' (24-hour format)
Shows labels for the hours.
Default: true
Labels that will be shown when showLabels
is true.
Default: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
Allows changing of time by moving clock hands.
Default: true
Allows changing of time by clicking hour labels
Default: true
Callback after setting time. It will pass the formatted time and jQuery element of the clock to the handler.
Sample handler format:
function onTimeSetHandler(formattedTime, jQueryEl) {
...do whatever...
}
There are some methods used to access data of analog clock.
$('#clock').analogClock(methodName, [arguments]);
Example:
$('#clock').analogClock('getTime', 'h:mm');
Gets the time displayed in the clock. If format is not specified, time will be formatted by initTime
.
Determines if time is AM or PM. (returns 'am' or 'pm')
jquery-analog-clock is released under the MIT License