cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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 ">
  <div class="row">
    <div class="title fa col-md-12">My Pomodoro</div>
  </div>
  <div class="controls">
    <div class="settings row">
        <div class="break fa col-md-6">Break Length</div>
        <div class="session fa col-md-6">Session Length</div>
    </div>
    <div class="display_settings row"> 
      <div class="col-md-6">
        <button id="less" class="bk-break">-</button>
        <div class="display_break fa">00</div>
        <button class="fwd-break ">+</button>
      </div>
      <div class="col-md-6">
        <button class="bk-session ">-</button>
        <div class="display_session fa">00</div>
        <button class="fwd-session">+</button>
      </div>
    </div>
  </div>
  <div id="example2form">
    <div class="pomProgressTimer img img-responsive">
      <span class="time fa" id="countdown">00:00:00</span>
    </div>
    <div class="#">
      <button id="start-countdown" class="btn btn-danger fa fa-play" type='button' value='Play/Pause' onclick='Example2.Timer.toggle();'> </button>
      <button id="pause" class="btn btn-danger fa fa-pause pause-countdown " type='button' value='Play/Pause' onclick='Example2.Timer.toggle();'></button>
      <button id="resume" class="btn btn-danger fa fa-resume resume-countdown" type='button' value='Play/Pause' onclick='Example2.Timer.toggle();'>Resume</button>
    </div>

    <input id="stop" type='button' value='Set' onclick='Example2.resetCountdown();' />
  </div>
</div>
</br>
</br>
            
          
!
            
              body{
 background:#D8D8D8;
 text-align:center;
}
.pomo{
  background:#e62e00;
}
.title{
 	font-family: 'Lobster', cursive;
  font-size:2.5em;
  color:white;
  text-shadow: .1px 1px 1px #555;
  font-weight:bold;
  text-transform: ;
  position:relative;
  top:25px;
  margin-bottom:25px;
}
.controls{
  position:relative;
  top:30px;
}
.settings{
  font-size:1em;
  text-shadow: 1px 1px 2px #fff;
}
.break, .session{
  padding:10px;
}
.display_break, .display_session {
  font-size:1.5em;
}
.bk-break,.fwd-break,.bk-session,.fwd-session{
  font-size:1em;
}
.display_settings{
   text-shadow: 1px 1px 2px #fff;
   margin-bottom:50px;
}

.pomProgressTimer{
   position:relative;
  margin:0 auto;
  top:30px;
  left:68px;
  padding-bottom:50px;   
}
.time{
  color:white;
  font-size:2.3em;
  position:relative;
  top:-105px;
  left:-175px; 
  text-shadow: 2px 2px 2px #555;
}
.btn{
  position:relative;
  box-shadow: 5px 5px 3px  #867979;
}
.fa-play{
  position:relative;
  top:-5px;
  text-shadow: 2px 2px 2px #555;
  width:50px;
  height:50px;
  border-radius: 360px;
  background-image: -webkit-gradient(linear, left top, left bottom, from(red), to(#2A0A0A),color-stop(0.4, #8c1b0b));
  display:
   
}
.fa-resume{
  position:relative;
  top:-5px;
  text-shadow: 1px 1px 1px #555;
  display:;
  width:70px;
  height:50px;
  border-radius: 360px;
  background-image: -webkit-gradient(linear, left top, left bottom, from(red), to(#2A0A0A),color-stop(0.4, #8c1b0b));
   
}
.fa-pause{
 position:relative;
  top:-5px;
  text-shadow: 1px 1px 1px #555;
  display:;
  width:50px;
  height:50px;
  border-radius: 360px;
  background-image: -webkit-gradient(linear, left top, left bottom, from(red), to(#2A0A0A),color-stop(0.4, #8c1b0b));
    
}
#stop{
  margin-top:15px;
}
.bk-break,.fwd-break,.bk-session,.fwd-session{
  background-color:transparent;
  border:none;
  padding:15px;
}
            
          
!
            
              $('#start-countdown').hide();
$('#resume').hide();
$('#pause').show();

//session or break time variable. session time = true, break time = false.
var timeBlock = 'true';

//display session / break length settings
var breakLength = 5;
var sessionLength = 25;
$('.display_break').text(breakLength);
$('.display_session').text(sessionLength);

//change break length
$('.bk-break').click(function() {
  if (breakLength > 0) {
    breakLength--;
    $('.display_break').text(breakLength);
  } else
    $('.display_break').text('Error!');
});
$('.fwd-break').click(function() {
  breakLength++;
  $('.display_break').text(breakLength);
});
//change session length
$('.bk-session').click(function() {
  if (sessionLength > 0) {
    sessionLength--;
    $('.display_session').text(sessionLength);
    $('.time').text(sessionLength + ':00:00');
  } else
    $('.display_session').text('Error!');
});
$('.fwd-session').click(function() {
  sessionLength++;
  $('.display_session').text(sessionLength);
  $('.time').text(sessionLength + ':00:00');
});
//arc progress bar animation
var pomCircle = function(x) {
  $('.pomProgressTimer').circleProgress({
    value: 1.0,
    thickness: '10',
    size: 225,
    lineCap: 'round',
    fill: {
      color: '#8c1b0b',
    },
    animation: {
      duration: x * 60500,
    },
  });
};

//timer functionality
var Example2 = new (function() {
  if (timeBlock = 'true') {
    var currentTime = 6000 * sessionLength;
  } else
    var currentTime = 6000 * breakLength;
  var $countdown,
    $form, // Form used to change the countdown time
    incrementTime = 70,
    updateTimer = function() {
      $countdown.html(formatTime(currentTime));
      if (currentTime == 0) {
        Example2.Timer.stop();
        timerComplete();
        Example2.resetBreak();
        return;
      }
      currentTime -= incrementTime / 10;
      if (currentTime < 0) currentTime = 0;
    },
    timerComplete = function() {
      alert('Break Time!: Session timer complete! Click OK to start Break. ');
    },
    init = function() {
      $countdown = $('#countdown');
      Example2.Timer = $.timer(updateTimer, incrementTime, true);
      $form = $('#example2form');
      $form.bind('submit', function() {
        Example2.resetCountdown();
        return false;
      });
    };
  this.resetCountdown = function() {
    var newTime = $('.display_session').text() * 6000;
    if (newTime > 0) {
      currentTime = newTime;
    }
    this.Timer.stop().once();
  };
  this.resetBreak = function() {
    var newTime = $('.display_break').text() * 6000;
    if (newTime > 0) {
      currentTime = newTime;
    }
    this.Timer.stop().once();
    pomCircle(breakLength);
    $(function() {
      $stopwatch = $('#stopwatch');
      Example2.Timer = $.timer(updateTimer, incrementTime, true);
    });
  };
  $(init);
  $(pomCircle(sessionLength));
})();

//play pause resume and reset functionality

$('#start-countdown').click(function() {
  $('#start-countdown').hide();
  pomCircle(sessionLength).animationStartValue = 0.0;
  Example2();
  // pomCircle.animationStartValue = 0.0;
});
$('#pause').on('click', function() {
  $('#resume').show();
  $('#pause').hide();
  $('#start-countdown').hide();
  var el = $('.pomProgressTimer');
  $(el.circleProgress('widget')).stop();
  $('body').toggleClass('pomo', 750, 'easeOutQuint');
  $('.settings').css('color', 'white');
  $('.settings').css('text-shadow', '1px 1px 2px #555');
  $('.display_settings').css('color', 'white');
  $('.display_settings').css('text-shadow', '1px 1px 2px #555');
});
$('.resume-countdown').on('click', function() {
  $('.pause-countdown').show();
  $('#start-countdown').hide();
  $('#resume').hide();
  $('body').toggleClass('pomo', 1000, 'easeOutQuint');
  var obj = $('.pomProgressTimer').data('circle-progress'),
    progress = obj.lastFrameValue;
  $('.pomProgressTimer').circleProgress({
    animationStartValue: progress,
  });
  $('.settings').css('color', 'black');
  $('.settings').css('text-shadow', '1px 1px 2px #fff');
  $('.display_settings').css('color', 'black');
  $('.display_settings').css('text-shadow', '1px 1px 2px #fff');
});
$('#stop').click(function() {
  $('#start-countdown').show();
  $('#pause').show();
  $('#resume').hide();
  pomCircle.animationStartValue = 0.0;
});
//time functions
function pad(number, length) {
  var str = '' + number;
  while (str.length < length) {
    str = '0' + str;
  }
  return str;
}

function formatTime(time) {
  var min = parseInt(time / 6000),
    sec = parseInt(time / 100) - min * 60,
    hundredths = pad(time - sec * 100 - min * 6000, 2);
  return (min > 0 ? pad(min, 2) : '00') + ':' + pad(sec, 2) + ':' + hundredths;
}
$(document).ready(function() {});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console