cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class='container'>
  <h2>Podomoro Session Clock</h2>
  <div class='header'>
  </div>
    <br>
<button class ='test'> Start </button>
<button  class ='stop'> Stop </button>
 
  <br></br>
  <div id="clock" class="col-md-2 circle ">
<h3 id = 'seq'></h3>
  <span id = 'podomoro'>    
  </span>
</div>
    <br>
<div class="row">
 <div class='col-md-6'>
   <p>Break Length</p>
      <button class='subBreak'>-</button>
      <span class='break'> </span>
      <button class='addBreak '>+</button>
     </div>
    
    <div class='col-md-6'>
      <p>Session Length</p>
    <button class='subSession '>-</button>
      <span class='session'> </span>
      <button class='addSession '>+</button>
    </div>
</div>
</div>

            
          
!
            
              /* https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css
*/
.container{
  width: 100%;
  margin: 0 auto;
  padding-top: 1.5em;
  padding-bottom: 8em;
  text-align:center;
  background:#3d3838;
  color:#fff;
}

.circle {
  height: 200px;
  padding-top: 2em;
  text-align:center;
  margin: 0 auto;
  border: 1px solid #fff;
  border-radius: 90%;
  border-color: #8bbaed;
}

h2 {
  color:#8bbaed;
}
p {
  font-size: large;
  color: #efa62f;
}

.test, .stop {
  color: red;
}


.subBreak,.addBreak,.subSession,.addSession{
  color: red;
  font-weight: 800;
}

#podomoro {
  font-size: xx-large;
}
            
          
!
            
              //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js

$(document).ready(function() {  //run jquery on load
  var breakLength = 3;
  var sessionLength = 25;
  $(".break").text(breakLength);
  $('.session').text(sessionLength);
  $('#podomoro').text(sessionLength);
   //break
  document.getElementById('seq').textContent = 'Session';
  $('.addBreak').on('click', function() {
    breakLength = breakLength + 1;
    $('.break').text(breakLength);
  });
  $('.subBreak').on('click', function() {
    breakLength = breakLength - 1;
    $('.break').text(breakLength);
  });
//session
  $('.addSession').on('click', function() {
    sessionLength = sessionLength + 1;
    $('.session').text(sessionLength);
    $('#podomoro').text(sessionLength);
  });
  $('.subSession').on('click', function() {
    sessionLength = sessionLength - 1;
    $('.session').text(sessionLength);
    $('#podomoro').text(sessionLength);
  });

  $('.test').on('click', function() {

    var secs = sessionLength * 60;
    var choice = true;
    var run = setInterval(function() { //The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).
      var h = Math.floor(secs / 3600); //Round a number downward to its nearest integer:
      var m = Math.floor(secs % 3600 / 60);
      var s = Math.floor(secs % 3600 % 60);
      document.getElementById('podomoro').innerHTML = (h < 10 ? '0' : '') + h + ":" + (m < 10 ? '0' : '') + m + ":" + (s < 10 ? '0' : '') + s;
      secs = secs - 1;

      if (secs < 0) {
        if (choice === true) {
          secs = breakLength * 60;
          document.getElementById('seq').textContent = 'Break';
          choice = false;  //getElementById() method returns the element that has the ID attribute with the specified value.
        } else {
          secs = sessionLength * 60;
          document.getElementById('seq').textContent = 'Session';
          choice = true;
        };
      };

    }, 1000);

    $('.stop,.subBreak,.addBreak,.subSession,.addSession').on('click', function() {
      clearInterval(run); //Display the current time (the setInterval() method will execute the function once every 1 second, just like a digital watch). Use clearInterval() to stop time:
    });
     
  }); 

});
            
          
!
999px
Loading ..................

Console