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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <body>
 
  <div id="clock">
    <h class="title"> Work Clock </h>

    <div id="settingWheel">

      <div id="timer1"> <h> Work</h>
      <button type="button" class="smallBut" id="plus">+</button>  
        <div id="set1"> </div><button type="button" class="smallBut" id="minus">-</button>
        </div>


      <div id="timer2"> <h> Break </h> <button type="button" class="smallBut" id="plus1">+</button>
        <div id="set2"> </div>
        <button class="smallBut" type="button" id="minus1">-</button>
      </div>


      <div id="face">

      </div>

 <button type="button" class="action" id="action">ActionTime!</button>  
      <button type="button" class="action" id="break">BreakTime!</button>
            <button type="button" class="action" id="pause">Pause</button>
 <button type="button" class="action" id="clear">Clear</button>

        </div>
              
            
!

CSS

              
                body{
  background-color:black;
}

#clock{
  background-color:#663300;
  height:550px;
  width:380px;
  margin:5% 29%;
  border-radius:15px;
}
#settingWheel{
   display: inline-block;
    border: 3px solid black;
    text-align: center;
  border-radius:160px;
  height:290px;
  width: 305px;
    margin: 7% 11%; 
  background-color:#663522;
        box-shadow: 7px 7px 9px  #211;

} 

#timer1 {      
    margin-top:15%;
  margin-left:15%;
 float:left;
  height:100px;
  width:100px;
  
}
#timer2 {
    margin-right:15%;

  margin-top:15%;
 float:right;
  height:100px;
  width:100px;
  
  }

#set1{
  font-weight:bold;
  font-size:20px;
    color:black;
  text-shadow:1px 0px #311;

}
#set2{
 text-shadow:1px 0px #311;

  font-weight:bold;
  font-size:20px;
    color:black;
}


#face {
  height:60px;
  width:300px;
  background-color:grey;
    margin-bottom:08%;
border:3px solid black;
      box-shadow: 3px 3px  #111;
  margin-top:100%;
  align:center;
  border-radius:10px;
 color:black;
  font-size:40px;
  box-shadow:5px black; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}

button{
  background-color:grey;
  border:1px solid black;
  border-radius:2px;
  font-weight:bold;
 text-align:center;
}
h{color:black;
font-size:23px;
font-weight:bold;
text-shadow:1px 0px #311;}

.action{
  margin:auto;
  align:center;
  font-weight:bold;
  color:black;
  font-size:20px;
  border-radius:7px;
  border:3px solid black;
  box-shadow: 3px 3px  #111;

}
.smallBut {
 width: 40px;
    margin:auto;
    display: block;
  font-size:16px;;
  font-color:black;
  color:black;
}
.title{
  font-weight:bold;
  text-decoration:underline;
  font-size:29px;
      text-shadow: 1px 1px  #111;
  margin-left:30%;
    margin-top:20%;
}
              
            
!

JS

              
                var time = 1250;
var time2 = 300;
var tickAudio = new Audio('http://soundbible.com/grab.php?id=2148&type=mp3');

$("#set1").text(Math.floor(time/60) + " m");
$("#set2").text(Math.floor(time2/60) + " m"); // Displays var time 
$("#face").text(Math.floor(time/60) + " m");

$("#plus").click (function() { //Plus
  time += 60;
  $("#face").text(getTime(time));
  $("#set1").text(getTime(time));
}); //Plus Minus Buttons functions

$("#minus").click(function() { //Minus
  time -= 60;
  $("#face").text(getTime(time));
  $("#set1").text(getTime(time));
});

$("#plus1").click(function() { //Plus (break)
  time2+=60;
     $("#set2").text(getTime(time2));
}); //Plus Minus for BreakTime

var timeoutId=0;
function increment(){
  time2+=60;
 $("#set2").text(getTime(time2));
};

 $("#plus1").mousedown(function() { 
   timeoutId= setTimeout(increment, 100);
}).bind('mouseup mouseleave', function() {
    clearTimeout(timeoutId);
});

$("#minus1").click(function() { //Minus (break)
  time2 -= 60;
  $("#set2").text(getTime(time2));
});

var countdownID;

$("#action").click(function() {
  countdownID = setInterval(countdown, 1000);

}); //COuntdown Button


function countdown() {
  $("#face").text(getTime(time)); //show time 
  $("#set1").text(getTime(time));
  $('#action').prop('disabled', true);
  $('#break').prop('disabled', false);

  if (time <= 0) { //if time gets to 0
    $('#action').prop('disabled', false);
        tickAudio.play();
        


    clearInterval(countdownID);
    time = 60;
    $("#face").text(getTime(time)); 
    $("#set1").text(getTime(time));
    
  }
  //stop that function with variable
  time -= 1;
}; //Countdown Button Function

var countdownID2;
$("#break").click(function() {
  clearInterval(countdownID);
  countdownID2 = setInterval(countdown2, 1000);
});

function countdown2() {
  $('#break').prop('disabled', true);
  $('#action').prop('disabled', false);

  $("#face").text(getTime(time2)); //show BREAK time 
  $("#set2").text(getTime(time2));

  if (time2 <= 0) {
            tickAudio.play();

    $('#break').prop('disabled', false);
    clearInterval(countdownID2);
    time2 = 60;
    console.log(time2);
    $("#face").text(getTime(time2)); 
    $("#set2").text(getTime(time2));
  }
  time2 -= 1;
};

$("#pause").click(function() {
  clearInterval(countdownID);
  clearInterval(countdownID2);
  
  $('#action').prop('disabled', false);
  $('#break').prop('disabled', false);

});
$("#clear").click(function() {
  clearInterval(countdownID);
  clearInterval(countdownID2);
  
  $('#action').prop('disabled', false);
  $('#break').prop('disabled', false);
$("#face").text(0); //show time 
 $("#set1").text(0);
   $("#set2").text(0);
  time=0;

});

//TIME CONVERTER
function getTime(seconds) { //Function to CONVERT TIME
  var hours = Math.floor(seconds / 3600);
  var minutes = Math.floor(seconds / 60);
  seconds = seconds - (minutes * 60);

  if (minutes >= 1 && minutes <= 59) {
    return (minutes + " m" + ':' + seconds + " s");
  }
   else
    return (seconds + " s");
}
              
            
!
999px

Console