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

Packages

Add Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>Pomodoro Clock</h1>
  
<h2>Break Length</h2>
<div class='settings' id='brkSets'>
  <div id='brkMinus' class='btn btn-default'>-</div>
  <p id='breakLength'></p>
  <div id='brkPlus' class='btn btn-default'>+</div>
</div>
  
<h2>Session Length</h2>
<div class='settings' id='lenSets'>
  <div id='lenMinus' class='btn btn-default'>-</div>
  <p id='sessionLength'></p>
  <div id='lenPlus' class='btn btn-default'>+</div>
</div>

<div id='pomodoro'>    
  <h3 id='status'>Session</h3>
  <h4 id='remain'>25:00</h4>
  <div id='start' class='btn btn-default'>Start / Stop</div>
</div>

            
          
!
            
              body * {
  font-family: arial;
  text-align: center;
}

h1 {
  font-size: 2.5em;
  background-color: red;
  color: white;
  margin: 0;
  padding: 10px;
}

h2 {
  background-color: #dae3f2;
  padding: 10px 30px;
}

p {
  font-size: 1.5em;
}

.btn {
  margin: auto 5px;
  border: none; 
}

.settings {
  display: flex;
  justify-content: center;
  align-items: center;
}

#pomodoro {
  height: 350px;
  width: 350px;
  margin: 20px auto;
  border: solid 5px red;
  border-radius: 50%;
}

h3 {
  margin-top: 50px;
  font-size: 2em;
}

h4 {
  position: relative;
  margin-top: 20%;
  font-size: 3.5em;
}
            
          
!
            
              $(document).ready(function() {
  var alarm = new Audio('http://soundbible.com/grab.php?id=1496&type=wav');
  var len = 25, brk = 5;
  var clicked = false; //checks if timer is currently running
  var countdown, displayVal;
  var timer = len * 60;
  var isSession = true; //checks if currently session or break
  
  $('#breakLength').html(brk);
  $('#sessionLength').html(len);
  
  // + and - buttons for session and break length
  $('#lenMinus').click(function() {
    len--;
    $('#sessionLength').html(len);
    $('#remain').html(`${len}:00`);
    if (isSession) {timer = len * 60;}
  });
  $('#lenPlus').click(function() {
    len++;
    $('#sessionLength').html(len);
    $('#remain').html(`${len}:00`);
    if (isSession) {timer = len * 60;}
  });
  $('#brkMinus').click(function() {
    brk--;
    $('#breakLength').html(brk);
    if (!isSession) {timer = brk * 60;}
  });
  $('#brkPlus').click(function() {
    brk++;
    $('#breakLength').html(brk);
    if (!isSession) {timer = brk * 60;}
  });
  
  //start stop button functionality
  $('#start').click(function() {
    if (!clicked) {
      clicked = true;
      countdown = setInterval(function() {
        timer--;
        
        //turns seconds display into min:sec
        if (timer%60 >= 10 && Math.floor(timer/60)%60 >= 10) {
          display = Math.floor(timer/60) + ':' + timer%60;
        } else if (timer%60 >= 10) {
          display = '0' + Math.floor(timer/60) + ':' + timer%60;
        } else if (Math.floor(timer/60)%60 >= 10) {
          display = Math.floor(timer/60) + ':0' + timer%60;
        } else {
          display = '0' + Math.floor(timer/60) + ':0' + timer%60;
        }
        
        $('#remain').html(display);
        if (timer === 0) {
          alarm.play();
          if (isSession) {
            timer = brk * 60;
            $('#status').html('Break');
          } else {
            timer = len * 60;
            $('#status').html('Session');
          }
          isSession = !isSession;
        }
      }, 1000);
    } else {
      clearInterval(countdown);
      clicked = false;
    } 
  });
});
            
          
!
999px

Console