JSFiddle - React, Tailwind, and code Playground
HTML
<div class="mainpanel">
<div>
test
</div>
<div class="shortly">
shortly
</div>
<button class="resetButton">
Reset
</button>
CSS
.mycount
{
background-color:green;
}
JavaScript
(function($) {
function countdown(el, options) {
var calc = function (target, current) {
/* Return true if the target date has arrived,
* an object of the time left otherwise.
*/
var current = current || new Date();
if (current >= target) { return true; }
var o = {};
var remain = Math.floor((target.getTime() - current.getTime()) / 1000);
o.days = Math.floor(remain / 86400);
remain %= 86400;
o.hours = Math.floor(remain / 3600);
remain %= 3600;
o.minutes = Math.floor(remain / 60);
remain %= 60;
o.seconds = remain;
o.years = Math.floor(o.days / 365);
o.months = Math.floor(o.days / 30);
o.weeks = Math.floor(o.days / 7);
return o;
};
var getWeek = function(date) {
var onejan = new Date(date.getFullYear(),0,1);
return Math.ceil((((date - onejan) / 86400000) + onejan.getDay())/7);
};
var options = $.extend({
date: new Date(),
modifiers: [],
interval: 1000,
msgFormat: '%d [day|days] %hh %mm %ss',
msgNow: 'Now !'
}, options);
var tokens = {
y: new RegExp ('\\%y(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g'), // years
M: new RegExp ('\\%M(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g'), // months
w: new RegExp ('\\%w(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g'), // weeks
d: new RegExp ('\\%d(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g'), // days
h: new RegExp ('\\%h(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g'), // hours
m: new RegExp ('\\%m(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g'), // minutes
s: new RegExp ('\\%s(.+?)\\[(\\w+)\\|(\\w+)\\]', 'g') // seconds
};
var formatToken...