JSFiddle - React, Tailwind, and code Playground

by freedawirl

HTML

<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdn.rawgit.com/hilios/jQuery.countdown/2.2.0/dist/jquery.countdown.min.js"></script>
<!-- 
  Bootstrap docs: https://getbootstrap.com/docs
-->
<div class="container">
  <div class="starter-template">
    <h1>Bootstrap starter template</h1>
    <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>
    <div class="panel panel-default" data-toggle="tooltip" data-placement="top" title="Beautifull, insn't it?">
      <div class="panel-body">
        <div class="lead" id="clock"></div>
      </div>
    </div>

    <button type="button" class="btn btn-primary" id="btn-reset">
      <i class="glyphicon glyphicon-repeat"></i>
      Reset countdown
    </button>

    <div class="btn-group" data-toggle="buttons">
      <label class="btn btn-default" id="btn-pause">
        <input type="radio" name="options" id="option2" autocomplete="off">
        <i class="glyphicon glyphicon-pause"></i>
        Pause
      </label>

      <label class="btn btn-default active" id="btn-resume">
        <input type="radio" name="options" id="option2" autocomplete="off" checked>
        <i class="glyphicon glyphicon-play"></i>
        Resume
      </label>
    </div>
  </div>
</div>

CSS

body {
  padding-top: 50px;
}

.starter-template {
  padding: 40px 15px;
  text-align: center;
}

.panel {
  width: 400px;
  margin-left: auto;
  margin-right: auto;
}

#btn-reset {
  margin-right: 10px;
}

#clock {
  margin-bottom: 0;
}

JavaScript

// Turn on Bootstrap
 $('[data-toggle="tooltip"]').tooltip();

 // 15 days from now!
 function get15dayFromNow() {
   return new Date(new Date().valueOf() + 44 * 24 * 60 * 60 * 1000);
 }

 var $clock = $('#clock');

 $clock.countdown(get15dayFromNow(), function(event) {
   $(this).html(event.strftime('%D days %H:%M:%S'));
 });

 $('#btn-reset').click(function() {
   $clock.countdown(get15dayFromNow());
 });

 $('#btn-pause').click(function() {
   $clock.countdown('pause');
 });

 $('#btn-resume').click(function() {
   $clock.countdown('resume');
 });