From 654c7fe5d0a09a23aad3dbffd20a824b29f3983b Mon Sep 17 00:00:00 2001 From: Matt Neary Date: Sun, 1 Dec 2013 20:48:04 -0500 Subject: [PATCH] day example --- css/media.css | 2 +- index.html | 4 ++-- js/jquery.countdown.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/css/media.css b/css/media.css index 5249d2f..8495c53 100644 --- a/css/media.css +++ b/css/media.css @@ -15,7 +15,7 @@ html, body, .wrapper { } #holder { - width: 503px; + width: 603px; height: 383px; margin: auto; } diff --git a/index.html b/index.html index 7b80628..5da8d41 100644 --- a/index.html +++ b/index.html @@ -9,8 +9,8 @@ $(function(){ $(".digits").countdown({ image: "img/digits.png", - format: "hh:mm:ss", - endTime: '04:50:00' + format: "dd:hh:mm:ss", + endTime: new Date(2013, 12, 25) }); }); diff --git a/js/jquery.countdown.js b/js/jquery.countdown.js index b68a031..94a6747 100644 --- a/js/jquery.countdown.js +++ b/js/jquery.countdown.js @@ -131,7 +131,7 @@ var moveDigit = function(elem, options) { // parses a date of the form hh:mm:ss, for example, where // ... precision is the same as the format. -var parseRelativeDate = function(form) { +var parseRelativeDate = function(form, options) { // give the date the values of now by default var now = new Date(); var d = now.getDate(); @@ -140,7 +140,7 @@ var parseRelativeDate = function(form) { var h = now.getHours(), mm, s; // read in components and render based on format - var format = userOptions.format||options.format; + var format = options.format; var parts = form.split(':'); if( format.indexOf('dd') == 0 ) { d = parts[0]; @@ -205,7 +205,7 @@ jQuery.fn.countdown = function(userOptions) { // if an endTime is provided... if( userOptions.endTime ) { // calculate the difference between endTime and present time - var endDate = userOptions.endTime instanceof Date ? userOptions.endTime : parseRelativeDate(userOptions.endTime); + var endDate = userOptions.endTime instanceof Date ? userOptions.endTime : parseRelativeDate(userOptions.endTime, options); var diff = endDate.getTime() - (new Date()).getTime(); // and set that as the startTime userOptions.startTime = formatCompute(new Date(diff), options);