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

              
                
<body>
	
	<div class="container-fluid" ng-app="StylishTimer" ng-controller="TimerControl">
		<div class="container header">Productivity Timer </div>

		
		<p> {{alert}}</p>
			
			
		<div class="row top">
		
			
		</div>
			<div class="row bottom">
			<div class="col-sm-4">
				<span class="set"> Timer Set(min)</span><br>
				<button type="button" class="btn btn-info" ng-click="sessionChangeMinus('-')">-</button>
			<span class="time">{{sessionLength}}</span>
				<button type="button" class="btn btn-info" ng-click="sessionChangePlus('+')" >+</button>
				</div>
			
			
			<div class="col-sm-4 ">
			
				<span class="set"> Start/Stop</span><br>
			<button type="button" class="btn btn-default timer" ng-click="timer()">{{timeLeft}}</button>
			</div>
			
			<div class="col-sm-4">
				<span class="set"> Break Time Set (min)</span><br>
					<button type="button" class="btn btn-info" ng-click="breakLengthChange(-1)" >-</button>
				<span class="time">{{breakLength}}</span>
				<button type="button" class="btn btn-info" ng-click="breakLengthChange(1)"  >+</button>
			</div>
			</div>
		
	
	
		
		<div class="container background">
			<div class="col-md-4"></div>
			<div class="col-md-4">	
		<center>	<img class="img-responsive" src="http://clipartsign.com/upload/2016/05/18/hourglass-clipart.jpg"></center>
		
			<div class="center"> <b> KEEP </b> <br> <b>CALM</b> <br> <small> AND </small> <br> <b>STAY</b> <br> <b>PRODUCTIVE</b></div></div>
			
			<div class="col-md-4"></div>
		</div>

	
	
	</div>


		
		</body>


	
	

	

	
	
              
            
!

CSS

              
                
.col-sm-4 {
	font-family: 'Oswald', sans-serif;
	text-align: center;
	

}

.btn-info {
	background-color: #53c68c;
	padding-top: 2px;
	padding-bottom: 2px;
	margin-left: 2px;
	margin-right: 2px;
	font-size: 20px;
		margin-top: 40px;
	margin-bottom: 40px;

}

.time {
	font-size:18px;
	padding-top: 5px !important;
	
}

.header {
	font-family: 'Pacifico', cursive;
	font-size: 60px;
	margin-top: 30px;
	margin-bottom: 60px;
	color: grey;
	text-align: center;
}

p{
	font-family: 'Oswald', sans-serif;
	text-align: center;
	font-size: 40px;
}

.img-responsive{
		margin-top: 20px;
    width: 100%;
    height: auto;
    opacity: 0.3;

}

.center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
	 opacity: 0.8;
}

.background {

	text-align: center;
}

.background{
		font-family: 'Oswald', sans-serif;
		margin-bottom: 20px !important;
	text-align: center;
	margin-bottom: 20px;
	height: 40px;
}

input {
	color: black;
	text-align: center;
}

.timer {
	color: #53c68c;
border: 0px;
	font-size: 40px;
	margin-top: 20px;
}
              
            
!

JS

              
                var app = angular.module('StylishTimer', []);

app.controller('TimerControl', function($scope, $interval) {
	
	
$scope.sessionLength = 30;
	$scope.breakLength = 5;
  $scope.timeLeft = $scope.sessionLength;
  $scope.currentTotal;
	
	var runTimer = false;
  var secs = 60 * $scope.timeLeft;
  $scope.originalTime = $scope.sessionLength;
  
  function secondsToHms(d) {
    d = Number(d);
    var h = Math.floor(d / 3600);
    var m = Math.floor(d % 3600 / 60);
    var s = Math.floor(d % 3600 % 60);
    return (
      (h > 0 ? h + ":" + (m < 10 ? "0" : "") : "") + m + ":" + (s < 10 ? "0" : "") + s
    ); 
  }
	
	$scope.sessionChangeMinus = function() {
		var str = $scope.sessionLength;
	
	  if ($scope.sessionLength === 0) {
			str = 0;
		} else if ($scope.sessionLength !== '0') {
			str = str -1;
		}
		
		$scope.sessionLength = str;	
	  $scope.timeLeft = $scope.sessionLength;
        $scope.originalTime = $scope.sessionLength;
        secs = 60 * $scope.sessionLength;
	}
	

	
		$scope.sessionChangePlus= function() {
		var str = $scope.sessionLength;
	if ($scope.sessionLength < 1000) {
			str = str + 1;
		}
		
		$scope.sessionLength = str;	
			  $scope.timeLeft = $scope.sessionLength;
        $scope.originalTime = $scope.sessionLength;
        secs = 60 * $scope.sessionLength;
	}
		
			  $scope.breakLengthChange = function(time) {
    if (!runTimer){
      $scope.breakLength += time;
      if ($scope.breakLength < 1) {
        $scope.breakLength = 0;
      }
      if ($scope.alert === 'Break!') {
        $scope.timeLeft = $scope.breakLength;
        $scope.originalTime = $scope.breakLength;
        secs = 60 * $scope.breakLength;
      }
    }}
  
				
				$scope.timer = function() {
					if(!runTimer) {
						if($scope.currentName === "Session"){
							$scope.currentLength = $scope.sessionLength;
						} else {
							$scope.currentLength = $scope.breakLength;
						} 
						updateTimer();
						runTimer = $interval(updateTimer, 1000);
					} else {
						$interval.cancel(runTimer);
						runTimer = false;
					}
				}
			
				function updateTimer() {
					secs -= 1;
					if(secs < 0) {
						 $scope.alert = "Time is Up!";
						
						if ($scope.alert === 'Break!') {
							$scope.alert = '';
							$scope.currentLength = $scope.sessionLength;
							$scope.timeLeft = 60 * $scope.sessionLength;
							$scope.originalTime = $scope.sessionLength;
							secs = 60 * $scope.sessionLength;
						} else {
							$scope.alert = 'Break!';
							$scope.currentLength = $scope.breakLength;
							$scope.timeLeft = 60 * $scope.breakLength;
							$scope.originalTIme = $scope.breakLength;
							secs = 60 * $scope.breakLength;
						}
					} else {
				
							$scope.timeLeft = secondsToHms(secs);
							
							var denom = 60 * $scope.originalTime;
							var perc = Math.abs((secs / denom) * 100 - 100);
							$scope.fillHeight = perc + '%';
						}
					}
	
				});
				
              
            
!
999px

Console