Showing
1 changed file
with
5 additions
and
4 deletions
@@ -36,26 +36,27 @@ function downCount(options) { | @@ -36,26 +36,27 @@ function downCount(options) { | ||
36 | _minute = _second * 60, | 36 | _minute = _second * 60, |
37 | _hour = _minute * 60, | 37 | _hour = _minute * 60, |
38 | _day = _hour * 24, | 38 | _day = _hour * 24, |
39 | - days, | ||
40 | hours, | 39 | hours, |
41 | minutes, | 40 | minutes, |
42 | seconds; | 41 | seconds; |
43 | 42 | ||
44 | // calculate dates | 43 | // calculate dates |
45 | - days = Math.floor(difference / _day), | ||
46 | hours = Math.floor((difference % _day) / _hour), | 44 | hours = Math.floor((difference % _day) / _hour), |
47 | minutes = Math.floor((difference % _hour) / _minute), | 45 | minutes = Math.floor((difference % _hour) / _minute), |
48 | seconds = Math.floor((difference % _minute) / _second); | 46 | seconds = Math.floor((difference % _minute) / _second); |
49 | 47 | ||
50 | // fix dates so that it will show two digets | 48 | // fix dates so that it will show two digets |
51 | - days = (String(days).length >= 2) ? days : '0' + days; | ||
52 | hours = (String(hours).length >= 2) ? hours : '0' + hours; | 49 | hours = (String(hours).length >= 2) ? hours : '0' + hours; |
53 | minutes = (String(minutes).length >= 2) ? minutes : '0' + minutes; | 50 | minutes = (String(minutes).length >= 2) ? minutes : '0' + minutes; |
54 | seconds = (String(seconds).length >= 2) ? seconds : '0' + seconds; | 51 | seconds = (String(seconds).length >= 2) ? seconds : '0' + seconds; |
55 | 52 | ||
56 | // set to DOM | 53 | // set to DOM |
57 | $countdownContainer.removeClass('hide'); | 54 | $countdownContainer.removeClass('hide'); |
58 | - $countDownHours.text('剩余' + hours + ':' + minutes + ':' + seconds); | 55 | + if (hours === '00') { |
56 | + $countDownHours.text('剩余' + minutes + ':' + seconds); | ||
57 | + } else { | ||
58 | + $countDownHours.text('剩余' + hours + ':' + minutes + ':' + seconds); | ||
59 | + } | ||
59 | 60 | ||
60 | difference -= 1000; | 61 | difference -= 1000; |
61 | 62 |
-
Please register or login to post a comment