Skip to content

Commit

Permalink
Added an example using data attributes to pass values to the jClock f…
Browse files Browse the repository at this point in the history
…unction. This is helpful for having a cleaner and more flexible js code.
  • Loading branch information
jorluiseptor committed May 7, 2013
1 parent d204dd7 commit 5118986
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/clock11.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<head>
<title>jclock - multiple clocks using different time zone offsets</title>

<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="jquery.jclock.js"></script>

<script type="text/javascript">
$(function($) {

$('.time').each(function() {

var myUtc = $(this).data('utc');
var myUtcOffset =$(this).data('utc-offset');
$(this).jclock({
utc: $(this).attr('data-utc'),
utcOffset: $(this).attr('data-utc-offset')
utc: myUtc ,
utcOffset: myUtcOffset
})

})

});
Expand All @@ -25,6 +25,7 @@
<body>
<h1>Using data attributes to specify options</h1>
<p>This example shows how to specify the values as attributes in HTML using HTML5 data- attributes as opposed to specifying them in the javascript code.</p>
<p><b>Note: You need jQuery 1.4.3 or greater for this to work.</b></p>

<p>EST: <span class="time" data-utc="true" data-utc-offset="-5"></span></p>

Expand Down
Loading

0 comments on commit 5118986

Please sign in to comment.