Hi,
I haven't worked with jQuery or Javascript really. Could someone please tell me how I would go about implementing this Binary Clock?
Hi,
I haven't worked with jQuery or Javascript really. Could someone please tell me how I would go about implementing this Binary Clock?
Go to the following URL:
http://www.scottklarr.com/files/binary-clock/clock.htm
and view the source.
Here is a breakdown:
This code sets up jQuery and the plugin:
<head>
<link href="binary-clock.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="binary-clock.js"></script>
</head>
It also references a style sheet, which can be downloaded from http://www.scottklarr.com/files/binary-clock/clock.css
This code:
<div id="binaryClock">
<div id="bcHa">
<img src="led0.png" alt="" id="bcHa1" />
<img src="led0.png" alt="" id="bcHa2" />
</div>
<div id="bcHb" class="edge">
<img src="led0.png" alt="" id="bcHb1" />
<img src="led0.png" alt="" id="bcHb2" />
<img src="led0.png" alt="" id="bcHb4" />
<img src="led0.png" alt="" id="bcHb8" />
</div>
<div id="bcMa">
<img src="led0.png" alt="" id="bcMa1" />
<img src="led0.png" alt="" id="bcMa2" />
<img src="led0.png" alt="" id="bcMa4" />
</div>
<div id="bcMb" class="edge">
<img src="led0.png" alt="" id="bcMb1" />
<img src="led0.png" alt="" id="bcMb2" />
<img src="led0.png" alt="" id="bcMb4" />
<img src="led0.png" alt="" id="bcMb8" />
</div>
<div id="bcSa">
<img src="led0.png" alt="" id="bcSa1" />
<img src="led0.png" alt="" id="bcSa2" />
<img src="led0.png" alt="" id="bcSa4" />
</div>
<div id="bcSb">
<img src="led0.png" alt="" id="bcSb1" />
<img src="led0.png" alt="" id="bcSb2" />
<img src="led0.png" alt="" id="bcSb4" />
<img src="led0.png" alt="" id="bcSb8" />
</div>
</div>
...is where the actual clock is referenced on the page. It contains div references for all of the image files that comprise the dot elements of the clock. It also contains some CSS class references, so some styling is taking place.
This code:
<script type="text/javascript">
$(document).ready(function() {
updateBinaryClock();
});
</script>
...waits for the page to fully load in the browser, and then kickstarts the clock plugin.