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.

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.

HTML

              
                <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Pomodoro Clock</title>
</head>

<body>
    <div class="container">
        <h1 id="title">Pomodoro Clock</h1>
        <div class="row">
            <div id="break">
                <h3 class="tooltip">Break Length</h3>
                <button id="br_p" class="btn">
                    <i class="fa fa-plus"></i>
                </button>
                <span id="br_val">5</span>
                <button id="br_m" class="btn">
                    <i class="fa fa-minus"></i>
                </button>
            </div>
            <div id="session">
                <h3 class="tooltip">Session Length</h3>
                <button id="se_p" class="btn btn-light">
                    <i class="fa fa-plus"></i>
                </button>
                <span id="se_val">25</span>
                <button id="se_m" class="btn btn-light">
                    <i class="fa fa-minus"></i>
                </button>
            </div>
        </div>
        <br>

        <div id="countdown">
            <div id="dial"></div>
            <div class="center"></div>
        </div>

        <div class="row">
            <button id="pauseBt" class="btn btn-light">
                <i class='fa fa-pause-circle'></i>
            </button>
            <button id="resetBt" class="btn btn-light">
                <i class="fa fa-times-circle"></i>
            </button>
        </div>


        
    </div>
    <audio id="alarm" src="https://s1.vocaroo.com/media/download_temp/Vocaroo_s1zsxn0hQc5a.mp3"></audio>
</body>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Righteous');

body {
    background: #151515;
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    margin: auto;
    margin-top: 10%;
    width: 400px;
    height: 400px;
}

#title {
    color: #C1E8F6;
    text-align: center;
    font-family: 'Righteous', cursive;
    font-weight: bold;
}

.btn {
    display: inline-block;
    background: none;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    font-size: 1.5em;
    z-index: 1000!important;
    color: #C1E8F6;
}

.btn:hover {
    color: #33B5E5;
}

.btn:focus {
    outline: none;
}

#br_val {
    display: inline-block;
    width: 27px;
}

#se_val {
    display: inline-block;
    width: 27px;
}

.row {
    position: relative;
}

.front {
    z-index: 2;
}

#break {
    position: absolute;
    left: 10%;
    text-align: center;
    color: #C1E8F6;
}

#session {
    position: absolute;
    right: 10%;
    text-align: center;
    color: #C1E8F6;
}

.tooltip {
    margin-bottom: 0;
    font-family: 'Righteous', cursive;
}

#countdown {
    width: 200px;
    height: 200px;
    margin: 65px auto 20px auto;
    position: relative;
    border-radius: 50%;
}

#countdown * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-family: DSEG14ClassicItalic;
    color: #C1E8F6;
}

.center {
    position: absolute;
    z-index: 100;
    top: 20%;
    width: 100%;
    text-align: center;
    font-size: 18px;
}

.session {
    color: #2A8542 !important;
}

.break {
    color: #33B5E5 !important;
}

.pause {
    color: #FFEB41 !important;
}

#pauseBt {
    position: absolute;
    padding: 0;
    left: 30%;
}

#pauseBt i {
    font-size: 30px;
}

#pauseBt i:hover {
    color: #33B5E5;
}

#resetBt {
    position: absolute;
    padding: 0;
    right: 30%;
}

#resetBt i {
    font-size: 30px;
}

#resetBt i:hover {
    color: #33B5E5;
}

#se_val {
    font-family: DSEG14ClassicBoldItalic;
    color: #33B5E5;
}

#br_val {
    font-family: DSEG14ClassicBoldItalic;
    color: #33B5E5;
}

/* Roundslider */

.rs-bg-color {
    background-color: #151515;
}


.rs-path-color {
    background-color: #C2E9F7;
}

.rs-handle {
    background-color: #C2E9F7;
    padding: 7px;
    border: 2px solid #C2E9F7;
}

.break .rs-range-color, .rs-range-color {
    background-color: #33B5E5;
}

.break .rs-handle.rs-focus, .rs-handle.rs-focus {
    border-color: #33B5E5;
}

.break .rs-handle:after, .rs-handle:after {
    border-color: #33B5E5;
    background-color: #33B5E5;
}

.session .rs-range-color {
    background-color: #308449;
}

.session .rs-handle.rs-focus {
    border-color: #308449;
}

.session .rs-handle:after {
    border-color: #308449;
    background-color: #308449;
}

.pause .rs-range-color {
    background-color: #FFEB41;
}

.pause .rs-handle.rs-focus {
    border-color: #FFEB41;
}

.pause .rs-handle:after {
    border-color: #FFEB41;
    background-color: #FFEB41;
}

.rs-border {
    border-color: transparent;
}
              
            
!

JS

              
                $(document).ready(function () {

    var session = 25;
    var brk = 5;
    var alarm = $("#alarm");

    if (localStorage.sesLen) {
        session = Number(localStorage.sesLen);
    }

    if (localStorage.brkLen) {
        brk = Number(localStorage.brkLen);
    }


    $("#dial").roundSlider({
        radius: 100,
        width: 8,
        handleSize: "+16",
        handleShape: "dot",
        sliderType: "min-range",
        readOnly: true,
        startAngle: 90,
        showTooltip: false
    });

    countdown(session, brk);

    function countdown(session, brk) {
        var remaining = session * 60;
        var state = "session";
        var pause = false;
        var total = remaining;
        var knobVal = 0;
        var br_val = $("#br_val");
        var se_val = $("#se_val");

        br_val.html(brk);
        se_val.html(session);

        $("#pauseBt").click(function () {
            pause = ~pause;
        });

        $("#resetBt").click(function () {
            state = "session";
            remaining = session * 60;
            total = remaining;
        });

        $("#br_p").click(function () {
            if (brk < 60) {
                brk++;
                br_val.html(brk);
                localStorage.setItem("brkLen", brk);
            }
        });

        $("#br_m").click(function () {
            if (brk > 1) {
                brk--;
                br_val.html(brk);
                localStorage.setItem("brkLen", brk);
            }
        });

        $("#se_p").click(function () {
            if (session < 60) {
                session++;
                se_val.html(session);
                localStorage.setItem("sesLen", session);
            }
        });

        $("#se_m").click(function () {
            if (session > 1) {
                session--;
                se_val.html(session);
                localStorage.setItem("sesLen", session);
            }
        });

        setInterval(function () {
            if (state == "session" && remaining == 0) {
                state = "break";
                remaining = brk * 60;
                total = remaining;
                alarm[0].play();
            } else if (state == "break" && remaining == 0) {
                state = "session";
                remaining = session * 60;
                total = remaining;
                alarm[0].play();
            }

            var seconds = Math.floor((remaining) % 60);
            var minutes = Math.floor((remaining / 60) % 60);
            updateTimer(state, pause, minutes, seconds);
            knobVal = Math.floor(100 - (remaining / total) * 100);
            $("#dial").roundSlider("option", "value", knobVal);
            if (!pause) {
                remaining -= 1;
            }
        }, 1000);

    }

    function updateTimer(state, pause, minutes, seconds) {

        function sec(sec) {
            return sec > 9 ? "" + sec : "0" + sec;
        }

        if (!pause) {
            $(".center").html(`
                                <h3 class="text-center ${state}">${state}</h3>
                                <h3 class="text-center">${minutes} : ${sec(seconds)}</h3>
                                `);
            $("#pauseBt").html("<i class='fa fa-pause-circle'></i>");
            document.getElementById("countdown").classList = state;
            document.getElementById("title").classList = state;
        } else {
            $(".center").html(`
                                <h3 class="text-center pause">pause</h3>
                                <h3 class="text-center">${minutes} : ${sec(seconds)}</h3>
                                `);
            $("#pauseBt").html("<i class='fa fa-play-circle'></i>");
            document.getElementById("countdown").classList = "pause";
            document.getElementById("title").classList = "pause";
        }
    }

});
              
            
!
999px

Console