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

              
                
<html lang="en">

<head>
    <link href="https://fonts.googleapis.com/css?family=Hind+Guntur" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="pomodoro.css">
    <script type="text/javascript" src="pomodoro.js"></script>
</head>

<body>
    <div class="timer-wrapper">
        <!--Timer Section-->
        <center>
            <h3>Pomodoro Clock</h3>
            <div class="pomodoro-clock">
                <h6 id="pomodoro-time">Session Time</h6>
                <h4 id="active-time"></h4>
                <button class="btn buttons" id="pomodoro-minus-five">-</button>
                <h3 id="num" style="margin:15px;">25</h3>
                <button class="btn buttons" id="pomodoro-plus-five">+</button>
                <button style="margin:15px;" class="btn button btn-info reset" id="reset-pomo">Restart</button>
            </div>
            <!--Break Timer-->
            <div id="break-timer">
                <h6 id="break-time">Break Time</h6>
                <button class="btn buttons" id="break-minus-five">-</button>
                <h3 id="breakNum">5</h3>
                <button class="btn buttons" id="break-plus-five">+</button>
            </div>
            <!--Start Button-->
            <button class="btn btn-success" id="start">START</button>
            <!--Stop/Pause Button-->
          <button class="btn btn-danger stop-pause">Stop Timer</button>
        </center>
    </div>
  <br/><br/>
  <p style="text-align: center;">Coded by <a href="http://www.drewcodes.io/" target="_blank">drewcodes</a></p>
</body>

</html>
              
            
!

CSS

              
                body {
    background-color: #d8d4af;
    font-family: 'Hind Guntur';
    color: white;
    margin: 20px;
}

.timer-wrapper {
    padding-top: 55px;
    height: 300px;
    width: 300px;
    margin-left: auto;
    margin-right: auto;
    background: -webkit-radial-gradient(center, rgba(255, 187, 96, 0.99) 0%, rgb(255, 128, 0) 70%);
    border-radius: 50%;
    border: 8px solid #d83a00;
    box-shadow: 10px 10px 20px black;
}

h3 {
    display: inline;
    margin: 10px;
}

#start {
    margin: 20px;
    width: 70px;
    border-radius: 5px;
}

.buttons {
    background-color: #d83e3e;
    border-radius: 50%;
}

.stop-pause {
  margin-top: 20px;
}


/*Timer*/

#num.enlarge {
    font-size: 60px;
    font-family: Heiti SC;
    transition: all 0.5s ease-out;
    background-color: #000000;
    color: #97db86;
    border-radius: 10px;
    padding-left: 10px;
    padding-right: 10px;
  border: 10px solid #d83a00;
}
              
            
!

JS

              
                $(document).ready(function () {
    //Hide reset buttons until is up.
    $('.reset').hide();
    $('.stop-pause').hide();
    // vars for actual time
    var time = parseInt($('#num').html());
    var breakTime = parseInt($('#breakNum').html());
    var countingDown = true;
    var alarm = new Audio('https://s3-us-west-2.amazonaws.com/guylemon/Buzzer.mp3');
    //Start button
    $('#start').click(function () {
        var countdown = setInterval(seconds, 1000);
        time *= 60;
        var stop = false;
        // Timer stop button
        function stopPause() {
            clearInterval(countdown);
        }
        $('.stop-pause').click(function () {
            if (stop === false) {
                stop = true;
                stopPause();
                $('.stop-pause').hide();
                $('.reset').show();
            }
        });
        //
        function seconds() {
            // Hide buttons
            $('#start, #pomodoro-minus-five, #pomodoro-plus-five, #break-minus-five, #break-plus-five, #breakNum, #pomodoro-time, #break-time').hide();
            // Enlarge Timer
            $('#num').addClass('enlarge');
            $('#active-time').show();
            $('#active-time').html('Time Left:');
            $('.stop-pause').show();
            time -= 1;
            if (time === 0) {
                alarm.play();
                clearInterval(countdown);
                var startBreak = setInterval(breakTimer, 1000);
                breakTime *= 60;
                $('#num').hide();
            }
            // Seconds to Mins Conversion
            if (time % 60 >= 10) {
                $('#num').html(Math.floor(time / 60) + ":" + time % 60);
            }
            else {
                // need this statement to correctly display numbers
                $('#num').html(Math.floor(time / 60) + ":" + '0' + time % 60);
            }
            //Break Timer
            function breakTimer() {
                $('#active-time').show();
                $('#active-time').html('Break time left:');
                $('#breakNum').show();
                breakTime -= 1;
                if (breakTime === 0) {
                    clearInterval(startBreak);
                    $('#reset-pomo').show();
                    $('#breakNum, #active-time').hide();
                }
                // Seconds to Mins Conversion
                if (breakTime % 60 >= 10) {
                    $('#breakNum').html(Math.floor(breakTime / 60) + ":" + breakTime % 60);
                }
                else {
                    // need this statement to correctly display numbers
                    $('#breakNum').html(Math.floor(breakTime / 60) + ":" + '0' + breakTime % 60);
                }
            }
        }
    });
    //Reset Button
    $('#reset-pomo').click(function () {
        time = 25;
        breakTime = 5;
        $('#num').html(time);
        $('#breakNum').html(breakTime);
        $('#pomodoro-time, #break-time, #num, #breakNum, #pomodoro-minus-five, #pomodoro-plus-five, #break-minus-five, #break-plus-five, #start').show();
        $('#num').removeClass('enlarge');
        $('#active-time').hide();
        $('#reset-pomo').hide();
    });
    // Pomodoro Clock Session Increment & Decrement Buttons
    $('#pomodoro-minus-five').click(function () {
        if (time > 5) {
            time -= 5;
            $('#num').html(time);
        }
    });
    $('#pomodoro-plus-five').click(function () {
        if (time >= 5) {
            time += 5;
            $('#num').html(time);
        }
    });
    // Break Buttons
    $('#break-minus-five').click(function () {
        if (breakTime > 5) {
            breakTime -= 5;
            $('#breakNum').html(breakTime);
        }
    });
    $('#break-plus-five').click(function () {
        breakTime += 5;
        $('#breakNum').html(breakTime);
        console.log(breakTime);
    });
});
              
            
!
999px

Console