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="container">
  <h1>Pomodoro Clock</h1>

  <div class="row" id="settings">
    <div class="col-lg-6" id="break">
      <p>Break</p>
      <button class="minus btn" id="minusBreak">-</button>
      <span id="breakLen">5</span>
      <button class="plus btn" id="plusBreak">+</button>
    </div>
    <div class="col-lg-6" id="session">
      <p>Session</p>
      <button class="minus btn" id="minusSession">-</button>
      <span id="sessionLen">25</span>
      <button class="plus btn" id="plusSession">+</button>
    </div>
  </div>

  <p id="currentTimer">Session</p>
  <div class="wrapper">
    <div id="timer" class="clock"></div>
  </div>

  <div class="controls">
    <button class="btn btn-success" id="start">Start</button>
    <button class="btn btn-primary" id="stop">Pause</button>
    <button class="btn btn-danger" id="reset">Reset</button>
  </div>

</div>
              
            
!

CSS

              
                body {
  background-image: url("https://images.unsplash.com/photo-1491947153227-33d59da6c448?auto=format&fit=crop&w=1400&q=80");
  font-family: 'Indie Flower';
}

.container {
  text-align: center;
  margin-top: 5%;
}

#settings {
  margin-top: 5%;
}

#currentTimer {
  padding-bottom: 2%;
  font-size: 28px;
}

.wrapper {
  text-align: center;
}

.clock {
  display: inline-block;
  width: auto !important;
}


              
            
!

JS

              
                // Dont change time if the wrong clock is on
// What happens when break timer gets to 0?
// Find a sound effect

$(document).ready(function() {

  var setBreak = 5;
  var setSession = 25;
  var breakLength = setBreak * 60;
  var sessionLength = setSession * 60;
  var clock;
  // var audio

  clock = $(".clock").FlipClock(sessionLength, {
    countdown: true,
    clockFace: 'MinuteCounter',
    autoStart: false,
    callbacks: {

      interval: function() {
        var time = clock.getTime().time;
        if (time === 0) {
          // audio.play();
          // Start break timer
          startBreak();
        }
      }
    }
  })

  function startBreak() {
    clock.setTime(breakLength);
    $("#currentTimer").html("Break");
    var time = clock.getTime().time;
    if (time === 0) {
      // audio.play();
      // Start session
      clock.start();
    }
  }

  // Add or subtract from break timer
  $("#plusBreak").click(function() {
    setBreak += 1;
    breakLength += 60;
    $("#breakLen").html(setBreak);
  })
  $("#minusBreak").click(function() {
    if (setBreak > 1) {
      setBreak -= 1;
      breakLength -= 60;
    }
    $("#breakLen").html(setBreak);
  })

  // Add or subtract from session timer
  $("#plusSession").click(function() {
    setSession += 1;
    sessionLength += 60;
    $("#sessionLen").html(setSession);
    clock.setTime(sessionLength);
  })
  $("#minusSession").click(function() {
    if (setSession > 1) {
      setSession -= 1;
      sessionLength -= 60;
    }
    $("#sessionLen").html(setSession);
    clock.setTime(sessionLength);
  })

  // Start the timer
  $("#start").click(function() {
    clock.start();
    $("#currentTimer").html("Session");
  })

  // Pause the timer
  $("#stop").click(function() {
    clock.stop();
  })

  // Reset the timer
  $("#reset").click(function() {
    clock.stop();
    clock.setTime(sessionLength);
  })

})
              
            
!
999px

Console