HTML5 Analog / Digital Clock Plugin With jQuery - Clock.js

File Size: 11.2 KB
Views Total: 9607
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
HTML5 Analog / Digital Clock Plugin With jQuery - Clock.js

Clock.js is a really small jQuery plugin which lets you render HTML5 analog and digital clocks with 3 built-in themes on the webpage.

How to use it:

1. Load the latest version of jQuery and the jQuery clock.js script in the html page.

<script src="//code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="js/clock-1.1.0.min.js"></script>

2. Create an empty DIV container for the clock.

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

3. Call the function to render a default clock inside the DIV container you created.

$("#clock").clock()

4. Customize the clock with the following options.

$("#clock").clock({

  // clock width
  width: 300,

  // clock height
  height: 450,

  // 't1' 't2' 't3'
  theme: 't1', 

  // set a new date
  date: new Date()
  
})

5. API.

var clock = $("#clock").clock(),
    data = clock.data('clock');

// pause the clock
data.pause();

// start the clock
data.start();

// set a new date
data.setTime(new Date());

This awesome jQuery plugin is developed by CaptDai. For more Advanced Usages, please check the demo page or visit the official website.