countdown.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //[countdown Javascript]
  2. //Project: Divine Art - Multipage Html Responsive Template
  3. //Version: 1.1
  4. //Primary use: Divine Art - Multipage Html Responsive Template
  5. //add your script here
  6. // countdown
  7. (function($) {
  8. /**
  9. * Set your date here (YEAR, MONTH (0 for January/11 for December), DAY, HOUR, MINUTE, SECOND)
  10. * according to the GMT+0 Timezone
  11. **/
  12. var launch = new Date(2017, 05, 14, 09, 00);
  13. /**
  14. * The script
  15. **/
  16. var days = $('#days');
  17. var hours = $('#hours');
  18. var minutes = $('#minutes');
  19. var seconds = $('#seconds');
  20. setDate();
  21. function setDate(){
  22. var now = new Date();
  23. if( launch < now ){
  24. days.html('<h1>0</H1><p>Day</p>');
  25. hours.html('<h1>0</h1><p>Hour</p>');
  26. minutes.html('<h1>0</h1><p>Minute</p>');
  27. seconds.html('<h1>0</h1><p>Second</p>');
  28. }
  29. else{
  30. var s = -now.getTimezoneOffset()*60 + (launch.getTime() - now.getTime())/1000;
  31. var d = Math.floor(s/86400);
  32. days.html('<h1>'+d+'</h1><p>Day'+(d>1?'s':''),'</p>');
  33. s -= d*86400;
  34. var h = Math.floor(s/3600);
  35. hours.html('<h1>'+h+'</h1><p>Hour'+(h>1?'s':''),'</p>');
  36. s -= h*3600;
  37. var m = Math.floor(s/60);
  38. minutes.html('<h1>'+m+'</h1><p>Minute'+(m>1?'s':''),'</p>');
  39. s = Math.floor(s-m*60);
  40. seconds.html('<h1>'+s+'</h1><p>Second'+(s>1?'s':''),'</p>');
  41. setTimeout(setDate, 1000);
  42. }
  43. }
  44. })(jQuery);
  45. // countdown
  46. (function($) {
  47. /**
  48. * Set your date here (YEAR, MONTH (0 for January/11 for December), DAY, HOUR, MINUTE, SECOND)
  49. * according to the GMT+0 Timezone
  50. **/
  51. var launch = new Date(2017, 05, 14, 09, 00);
  52. /**
  53. * The script
  54. **/
  55. var days_1 = $('#days_2');
  56. var hours_1 = $('#hours_2');
  57. var minutes_1 = $('#minutes_2');
  58. var seconds_1 = $('#seconds_2');
  59. setDate();
  60. function setDate(){
  61. var now = new Date();
  62. if( launch < now ){
  63. days_1.html('<h1>0</H1><p>Day</p>');
  64. hours_1.html('<h1>0</h1><p>Hour</p>');
  65. minutes_1.html('<h1>0</h1><p>Minute</p>');
  66. seconds_1.html('<h1>0</h1><p>Second</p>');
  67. }
  68. else{
  69. var s = -now.getTimezoneOffset()*60 + (launch.getTime() - now.getTime())/1000;
  70. var d = Math.floor(s/86400);
  71. days_1.html('<h1>'+d+'</h1><p>Day'+(d>1?'s':''),'</p>');
  72. s -= d*86400;
  73. var h = Math.floor(s/3600);
  74. hours_1.html('<h1>'+h+'</h1><p>Hour'+(h>1?'s':''),'</p>');
  75. s -= h*3600;
  76. var m = Math.floor(s/60);
  77. minutes_1.html('<h1>'+m+'</h1><p>Minute'+(m>1?'s':''),'</p>');
  78. s = Math.floor(s-m*60);
  79. seconds_1.html('<h1>'+s+'</h1><p>Second'+(s>1?'s':''),'</p>');
  80. setTimeout(setDate, 1000);
  81. }
  82. }
  83. })(jQuery);
  84. // countdown
  85. (function($) {
  86. /**
  87. * Set your date here (YEAR, MONTH (0 for January/11 for December), DAY, HOUR, MINUTE, SECOND)
  88. * according to the GMT+0 Timezone
  89. **/
  90. var launch = new Date(2017, 05, 14, 09, 00);
  91. /**
  92. * The script
  93. **/
  94. var days_3 = $('#days_3');
  95. var hours_3 = $('#hours_3');
  96. var minutes_3 = $('#minutes_3');
  97. var seconds_3 = $('#seconds_3');
  98. setDate();
  99. function setDate(){
  100. var now = new Date();
  101. if( launch < now ){
  102. days_3.html('<h1>0</H1><p>Day</p>');
  103. hours_3.html('<h1>0</h1><p>Hour</p>');
  104. minutes_3.html('<h1>0</h1><p>Minute</p>');
  105. seconds_3.html('<h1>0</h1><p>Second</p>');
  106. }
  107. else{
  108. var s = -now.getTimezoneOffset()*60 + (launch.getTime() - now.getTime())/1000;
  109. var d = Math.floor(s/86400);
  110. days_3.html('<h1>'+d+'</h1><p>Day'+(d>1?'s':''),'</p>');
  111. s -= d*86400;
  112. var h = Math.floor(s/3600);
  113. hours_3.html('<h1>'+h+'</h1><p>Hour'+(h>1?'s':''),'</p>');
  114. s -= h*3600;
  115. var m = Math.floor(s/60);
  116. minutes_3.html('<h1>'+m+'</h1><p>Minute'+(m>1?'s':''),'</p>');
  117. s = Math.floor(s-m*60);
  118. seconds_3.html('<h1>'+s+'</h1><p>Second'+(s>1?'s':''),'</p>');
  119. setTimeout(setDate, 1000);
  120. }
  121. }
  122. })(jQuery);