cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

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.

            
              <body>
    <div id="canvas">
        <div id="title">
            <div id="title" class="noselect">Pomodoro Timer</div>
        </div>
        <div id="settings">

            <div class="adjustor">
                <div class="adjustor-title noselect">BREAK LENGTH</div>
                <div class="elements">
                    <div id="decr-break-time" class="button noselect">-</div>
                    <div id="break-number" class="number noselect"></div>
                    <div id="incr-break-time" class="button noselect">+</div>
                </div>
            </div>

            <div class="adjustor">
                <div class="adjustor-title noselect">SESSION LENGTH</div>
                <div class="elements">
                    <div id="decr-session-time" class="button noselect">-</div>
                    <div id="session-number" class="number noselect"></div>
                    <div id="incr-session-time" class="button noselect">+</div>
                </div>
            </div>
        </div>


        <div id="time-elapsing-area" class="noselect">
            <div id="timer-name"></div>
            <div id="time-elapsed"></div>
            <!--div id="span-container">
                <div id="span-minutes"></div>
                <div id="span-colons">:</div>
                <div id="span-seconds"></div>
            </div-->

        </div>
    </div>
    </div>

            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Raleway');
* {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    font-family: Arial, "Helvetica Nueu", sans-serif;
    padding: 0;
    font-size: 20px;
}

#canvas {
    /*
    background-image: url('https://source.unsplash.com/wgivdx9dBdQ/1600x900');
    background-size: cover;
    
    
    */
    height: 100vh;
    min-height: 700px;
    /*background-color: darkslategrey;*/
    background-color: #141215;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 0;
    /*min-width: 550px;
    margin: auto;*/
}

#settings {
    font-family: 'Quicksand', sans-serif;
    font-weight: thin;
    margin-top: 20px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

#settings .adjustor {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 50%;
    min-width: 200px;
    color: #ffffff;
    margin: 5px;
    font-size: 15px;
}

.adjustor-title {
    font-size: 13px;
}

#settings .elements {
    display: flex;
    flex-flow: row;
    justify-content: center;
    align-content: center;
    align-items: center;
    min-width: 160px;
}

#settings .number {
    text-align: center;
    color: #ffffff;
    font-size: 30px;
    margin-left: 10px;
    margin-right: 10px;
    min-width: 30%;
}

.button {
    cursor: pointer;
    font-size: 20px;
    text-decoration: none;
    color: #ffffff;
}

#clock-bar {
    height: 250px;
    width: 130px;
    background-color: grey;
}

#title {
    color: #ffffff;
}

#time-elapsing-area {
    font-family: 'Quicksand', sans-serif;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    min-height: 250px;
    min-width: 250px;
    background-color: #141215;
    cursor: pointer;
    -moz-border-radius: 125px;
    -webkit-border-radius: 125px;
    border-radius: 100%;
    border: 3px solid #4CAF50;
}

#timer-name {
    text-align: center;
    margin-top: 10px;
    color: #ffffff;
    font-size: 25px;
}

#time-elapsed {
    font-family: Arial, Helvetica, sans-serif;
    color: #ffffff;
    font-size: 70px;
    padding-top: 35px;
    font-weight: thin;
    min-width: 200px;
    text-align: center;
}


/*
#span-container {
    display: flex;
    flex-flow: row;
    justify-content: center;
    align-content: center;
    align-items: center;
    font-size: 70px;
    color: #ffffff;
    min-width: 70px;
}

#span-minutes {
    margin-left: 10px;
    margin-right: 1px;
    min-width: 49%;
    text-align: center;
}

#span-colons {
    margin-left: 10px;
    margin-right: 1px;
    min-width: 2%;
    text-align: center;
}

#span-seconds {
    text-align: center;
    margin-left: 1px;
    margin-right: 10px;
    min-width: 49%;
}*/

.noselect {
    -webkit-touch-callout: none;
    /* iOS Safari */
    -webkit-user-select: none;
    /* Safari */
    -khtml-user-select: none;
    /* Konqueror HTML */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* Internet Explorer/Edge */
    user-select: none;
}

.not-active {
    pointer-events: none;
    cursor: default;
}
            
          
!
            
              $(document).ready(function () {

    var breakTime = 5;
    var sessionTime = 25;
    var isOn = false;
    var sessionInterval = null;
    var breakInterval = null;
    var countingTime = sessionTime * 60;
    var sessionTimeIsOn = true;
    var finalBar = countingTime;
    var barHeight = $("#time-elapsing-area").height();
    var percentageInitial = 100;
    var percentageCurrent = 100;
    var interval = 100 / countingTime;
    console.log(countingTime, interval);
    $("#break-number").text(breakTime);
    $("#session-number").text(sessionTime);
    $("#time-elapsed").text(sessionTime);
    $("#timer-name").text("SESSION");

    $("#decr-break-time").click(function () {
        if (breakTime > 1) {
            breakTime--;
        }
        if (!sessionTimeIsOn) {
            countingTime = breakTime * 60;
            finalBar = countingTime;
            interval = 100 / countingTime;
            percentageCurrent = 100;
            $("#break-number").text(breakTime);
            $("#time-elapsed").text(breakTime);
            console.log(countingTime, interval);

        } else {
            $("#break-number").text(breakTime);
        }
    });

    $("#incr-break-time").click(function () {
        breakTime++;
        if (!sessionTimeIsOn) {
            countingTime = breakTime * 60;
            finalBar = countingTime;
            interval = 100 / countingTime;
            percentageCurrent = 100;
            $("#break-number").text(breakTime);
            $("#time-elapsed").text(breakTime);
            console.log(countingTime, interval);
        } else {
            $("#break-number").text(breakTime);
        }

    });

    $("#decr-session-time").click(function () {
        if (sessionTime > 1) {
            sessionTime--;
        }
        if (sessionTimeIsOn) {
            countingTime = sessionTime * 60;
            finalBar = countingTime;
            interval = 100 / countingTime;
            percentageCurrent = 100;
            $("#session-number").text(sessionTime);
            $("#time-elapsed").text(sessionTime);
            console.log(countingTime, interval);
        } else {
            $("#session-number").text(sessionTime);
        }

    });

    $("#incr-session-time").click(function () {
        sessionTime++;
        if (sessionTimeIsOn) {
            countingTime = sessionTime * 60;
            finalBar = countingTime;
            interval = 100 / countingTime;
            percentageCurrent = 100;
            $("#session-number").text(sessionTime);
            $("#time-elapsed").text(sessionTime);
            console.log(countingTime, interval);
        } else {
            $("#session-number").text(sessionTime);
        }
    });

    $("#time-elapsing-area").click(function () {
        if (!isOn) {
            startSessionTimer();
            isOn = true;
            //console.log("isOn=", isOn);
        } else {
            stopSessionTimer();
            isOn = false;
            //console.log("isOn=", isOn);
        }
    });

    function startSessionTimer() {
        makeInactive("#decr-break-time", "not-active");
        makeInactive("#incr-break-time", "not-active");
        makeInactive("#decr-session-time", "not-active");
        makeInactive("#incr-session-time", "not-active");

        sessionInterval = setInterval(function () {
            if (countingTime === 0 && sessionTimeIsOn) {

                $("#timer-name").text("BREAK");
                countingTime = breakTime * 60;
                sessionTimeIsOn = false;
                finalBar = countingTime;
                interval = 100 / countingTime;
                percentageCurrent = 100;
            }
            if (countingTime === 0 && !sessionTimeIsOn) {

                $("#timer-name").text("SESSION");
                countingTime = sessionTime * 60;
                sessionTimeIsOn = true;
                finalBar = countingTime;
                interval = 100 / countingTime;
                percentageCurrent = 100;
            }

            countingTime--;

            var seconds = countingTime % 60;
            var minutes = (countingTime - seconds) / 60;
            seconds = seconds < 10 ? "0" + seconds : seconds;
            //if (seconds < 10) {
            $("#time-elapsed").text(minutes + ":" + seconds);
            /*$("#span-minutes").text(minutes);
            $("#span-seconds").text(seconds);
            console.log($("#span-minutes").text());
            console.log($("#span-seconds").text());*/

            // } else {
            $("#time-elapsed").text(minutes + ":" + seconds);
            /*$("#span-minutes").text(minutes);
            $("#span-seconds").text(seconds);

            console.log($("#span-minutes").text());
            console.log($("#span-seconds").text());*/
            //}

            /*Animation*/
            percentageCurrent -= interval;
            console.log(percentageCurrent);
            $("#time-elapsing-area").css(
                'background',
                'linear-gradient(#141215 ' + percentageCurrent + '%,#426e1f ' + percentageCurrent + '%'
            );
            /*Animation*/

        }, 1000);

    }

    function stopSessionTimer() {
        clearInterval(sessionInterval);
        makeActive("#decr-break-time", "not-active");
        makeActive("#incr-break-time", "not-active");
        makeActive("#decr-session-time", "not-active");
        makeActive("#incr-session-time", "not-active");
    }

    function makeInactive(divElement, classToAdd) {
        $(divElement).addClass(classToAdd);
    }

    function makeActive(divElement, classToAdd) {
        $(divElement).removeClass(classToAdd);
    }


});
            
          
!
999px
Loading ..................

Console