Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="contain">
  <div id="clockdiv">
    <span class="minutes"></span>
    :
    <span class="seconds"></span>
  </div>
  <div class="buttons">
  <button id="start">START</button>
 
  <button id="reset">RESET</button>
  <button id="stop">BREAK</button>
  </div>
  <div id="controls">
    <div id="startTime">
    <button id="add">+</button>
      <span id="length_time">25:00</span>
    <button id="less-length">-</button>
    </div>
    <div id="breakTime">
    <button id="addB">+</button>
      <span id="break_time">5:00</span>
    <button id="lessB">-</button>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400');
@import url('https://fonts.googleapis.com/css?family=Raleway:500');
@import url('https://fonts.googleapis.com/css?family=Quicksand:100');
@import url('https://fonts.googleapis.com/css?family=Yantramanav:300');
html,body{
  margin:0;
  padding:0;
  height:100%;
  width:100%;

  
  background:url(' https://images.unsplash.com/photo-1491592382973-75316efb392c?auto=format&fit=crop&w=1566&q=60&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D')50% 50% no-repeat ;
  
  
 
  
display:table;
  top:0;
  background-size:cover;
  background-attachment:fixed;
 

    display: flex;
  justify-content: center;
  align-items: center;
 
}
#clockdiv{
  width:100%;
  margin:auto;
  font-size:200px;
  font-weight:thin 100;
  font-family:Yantramanav;
  background-attachment:fixed;
  
  color:#262627;
}
.buttons{
  
  width:100%;
  margin-top:10%;
  margin-bottom:5%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family:Raleway;
  font-weight:Medium 500;
}
button{
  outline:none;
  background-color:Transparent;
  cursor:pointer;
  border:none;
  
  color:#151516;
  
}

#start{
  font-size:20px;
  margin-right:21%;
  margin-left:6%;
}

#reset{
   font-size:20px;
  border-radius:5px;
  margin-right:1%;
  margin-left:9%;
}
#stop{
   font-size:20px;
  border-radius:5px;
  margin-right:1%;
  margin-left:29%;
}
#controls{
  width:100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family:Source Sans Pro;
  font-weight:regular 400;
  color:#4A4B4B;
  
  
}

#startTime{
  font-size:35px;
  margin-right:20%;
}

#breakTime{
  font-size:35px;
  margin-left:10%;
}
#add,#less-length,#addB,#lessB{
  color:#151516;
  font-size:15px;
}
              
            
!

JS

              
                
$(document).ready(function () {
  var i;
  var deadline;
  var timeInterval;
  var work_minutes=25;
  var break_minutes=5;
  var clock=document.getElementById('clockdiv');
  var bminutes=clock.querySelector('.minutes');
  var bseconds=clock.querySelector('.seconds');
  bminutes.innerHTML=("0" + work_minutes).slice(-2);
  bseconds.innerHTML=("00");
  //length control buttons
  $("#add").click(function(){
  work_minutes=work_minutes+5;
   if(work_minutes>90){
      work_minutes=90;
    } 
    bminutes.innerHTML=("0" + work_minutes).slice(-2);
    $("#length_time").html(work_minutes+":00");
  });
  
    $("#less-length").click(function(){
  work_minutes=work_minutes-5;
   if(work_minutes<5){
      work_minutes=05;
    } $("#length_time").html(work_minutes+":00");
      bminutes.innerHTML=("0" + work_minutes).slice(-2);
  });
  //break control buttons
  $("#addB").click(function(){
  break_minutes=break_minutes+1;
    
   if(break_minutes>15){
      break_minutes=15;
    } $("#break_time").html(break_minutes+":00");});
    $("#lessB").click(function(){
  break_minutes=break_minutes-1;
    
   if(break_minutes<1){
      break_minutes=01;
    } $("#break_time").html(break_minutes+":00");
  });
  //time remaining
  function timeRemaining(endtime){
     var total=Date.parse(endtime)-Date.parse(new Date());
     var minutes=Math.floor((total/1000/60) % 60);
     var seconds=Math.floor((total/1000)%60);
    
     return {
       'total': total,
       'minutes':minutes,
       'seconds':seconds
     };
    
   }
  
  //
  function updateClock(){
    
         timeInterval = setInterval(function(){
          
        var t = timeRemaining(deadline);
         bminutes.innerHTML=("0" + t.minutes).slice(-2);
          bseconds.innerHTML=("0" + t.seconds).slice(-2);
          
    if(t.total<=0){
      clearInterval(timeInterval);
    
    if(i===0){
      BreakClock();
       
    }
    else if(i===1){
      StartPomo();
    }}    
  },1000); }
      
      function StartPomo(){
        bminutes.innerHTML=("0" + work_minutes).slice(-2);
        bseconds.innerHTML="00";
        
       deadline= new Date(Date.parse(new Date())+work_minutes*60*1000);
        updateClock();
        i=0;
        
      }
  function BreakClock(){
    clearInterval(timeInterval);
   
    bminutes.innerHTML=("0" + break_minutes).slice(-2);
        bseconds.innerHTML=("00");
    deadline= new Date(Date.parse(new Date())+break_minutes*60*1000);
    
        updateClock();
        i=1;
  }
  
    function ResetClock(){
      clearInterval(timeInterval);
       
       bminutes.innerHTML=("0" + work_minutes).slice(-2);
        bseconds.innerHTML="00";
      
      
    }
 $("#start").click(function(){
   StartPomo();
 });
  $("#stop").click(function(){
   BreakClock();
 });
  $("#reset").click(function(){
   ResetClock();
 });
    
 
});
              
            
!
999px

Console