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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <h1>Download Rebound - ft. Dodgy radial loader</h1>
<div class="downloadButton-base">
	<div class="downloadButton-button">
		<div class="downloadButton-innerButton">
			<div class="icon"></div>
		</div>
		<div class="timer"></div>
	</div>	
</div>
<div class="downloading"><div class="percent"></div> Downloading
  </div>
              
            
!

CSS

              
                @import "compass/css3";

@import "compass";
@import "compass/reset";

//Em Calculator
@function emCalc($target, $context:16) {
	@return $target / $context * 1em;
}
// Vars

$size:emCalc(220);


// Styling Code

body {
	@include background-image(radial-gradient( 50% 0, 100% 100%, #e7eaee 0, #bdc3ce 600px));
	font-family: sans-serif;
  color:#777c85;
}

h1 {
  text-align:center;
  font-size:1.5em;
  margin-top:1.25em;
}


.downloadButton-base {
	
	@include box-shadow(0px 2px 2px rgba(#fff,0.5), 0px 2px 12px rgba(#000,0.3) inset);
	@include background-image(linear-gradient(#d6dbe6, #c6cbd5));
	height:$size;
	width:$size;
	border-radius:$size;
	padding:emCalc(20);
	margin:30px auto;
}

.downloadButton-button {
	
	@include box-shadow(0px 8px 12px rgba(#000,0.35), 0px 2px 2px rgba(#fff,1) inset, 0px -20px 15px rgba(#000,0.1) inset,  0px -8px 5px rgba(#000,0.03) inset);
	@include background-image(linear-gradient(#f4f5f6, #b3b7c2));
	height:$size;
	width:$size;
	border-radius:$size;
	position: relative;
	z-index: 1;

	&:hover {
		@include box-shadow(0px 6px 10px rgba(#000,0.35), 0px 2px 2px rgba(#fff,1) inset, 0px -20px 15px rgba(#000,0.1) inset,  0px -8px 5px rgba(#000,0.03) inset);
	}

}

.downloadButton-innerButton {
	
	@include box-shadow(0px 2px 2px rgba(#fff,0.5), 0px 4px 20px rgba(#bbbfc7,0.5) inset, 0px 0px 10px rgba(#fff,0.10)); // multiple: comma-delimited
	@include background-image(linear-gradient(#d2d5d9, #d9dbe2));
	height:emCalc(120);
	width:emCalc(120);
	border-radius:$size;

	margin-left: - emCalc(60);
	margin-top: - emCalc(60);
	position: absolute;
	left:50%;
	top:50%;

	text-align: center;

}

.downloading {
	text-align: center;
	display:none;
	text-transform: uppercase;
	font-size:13px;

	.percent {
		display:inline;
	}
}

/*Third Part Hack code*/

.timer {
	position:relative;
	font-size: 260px;
	width:1em;
	height:1em;
	float: left;
	margin-left:-20px;
	margin-top:-20px;

	& > #slice {
		position:absolute;
		width:1em;
		height:1em;
		clip:rect(0px,1em,1em,0.5em);
	}
	& > #slice.gt50 {
		clip:rect(auto, auto, auto, auto);
	}
	& > #slice > .pie {
		border: 0.1em solid #e7c597;
		position:absolute;
		width:0.8em; /* 1 - (2 * border width) */
		height:0.8em; /* 1 - (2 * border width) */
		clip:rect(0em,0.5em,1em,0em);
		-moz-border-radius:0.5em;
		-webkit-border-radius:0.5em; 
		border-radius:0.5em; 
	}
	& > #slice > .pie.fill {
		-moz-transform:rotate(180deg) !important;
		-webkit-transform:rotate(180deg) !important;
		-o-transform:rotate(180deg) !important;
		transform:rotate(180deg) !important;
	}
	&.fill > .percent {
		display: none;
	}
	&.fill > #slice > .pie {
		border: transparent;
		background-color: #f00;
		width:1em;
		height:1em;
	}
}

.icon {

	height:44px;
	margin-top:emCalc(60)- (emCalc(44)/2);
	background-position: center;
	background-repeat: no-repeat;
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAsCAYAAAAn4+taAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACW1JREFUeNrMWWtsFNcVvjuzu/a+34vNGozX2Bhjg40TDEkIBBQEtkLaKikVqlRFNJVSRVVUSqP0QdsobaRUpDSKgqL8QGqaKC1NqpRUqZI2D6WiMcUY8zBgjDGuMdj4te/3br8zvrOMwdhrvCa+8DE7s3d27jfn3HO+c1BlMhmWy3hx3xssx7EBaAbWAEZgGT+eAFL8+A/gY8CX648+t/vJKb9Xs/wMO/ArYAfgus2cOn5sAHZxUkToeeDobBcwWyI64IfAHsBCF7QaLSso1DENjioVHqDW4KhiyUSCZfCHjvF4jMViUTGdyTRz6/0J+BnQ9VUQKQLeJxcSVAIzmsysEAQEQZj8QRqNdCSCOr1B+gwyLBgMsEQivoMTepxb6a4RIf9/T8VUHoPByAxGk/TW5VFYoI25XbZRp8Pip+s4T0RjcU0gENYNXB+1+vxBE80rKCiUEI1GWDDgNyZTyQ9w+cfAy3eDyFLgQ1EQ7VabXXrDWRO57UN1tRW9xUUO/1Q/EAiGC86cvVTcebFvUSqVEsmSRGhsbESElfZhSgQ4MJdEaB+8j8XbbVY7E0RxfKMUFkTva6w5t7hkwRifNwQcA87xTR0AyAoeYLXJqK9ce++Knppqb/+/vzxZefXasJMsZ7M5WMDvY6FwcD/mnQc+mSsir6lFdTU9UN4LdpvZt3lDwxmjQRfH6RHgTYTqc9OEUicOj+Cex7dubjx9pOW093xX72L6zmS2UFDQhsOhd3BaBYzkmwg2tWqnVUHCZjX5m7asa9eoxWs4/Q0ItOeYk8hiB0GIgsUzsCbTatXJUx3dXomMycJSyaQrFo/9FKe7c/lNYQZEXjJbbAin49wLtJr4lofuPQUStPinciVxE6ERYC8+vn1PfVWvp9g1SNfJzSzkuirhaZzW5vJ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/sUnNPiJRslDquj97Jx38u0JE4WavwCp9SjISiQdXn+Qk9uSTxHRRa1ZksDkFkHna7bL6h0f8Ru+ShUPIxj5uiVP5fqbA5mhgsdSdfBWh1b9yRXn/XJKYUfidxVjB9diR2TT7phv/F2AAsjFPJoCTJREAAAAASUVORK5CYII=');
}
              
            
!

JS

              
                var timer;
var timerCurrent;
var timerFinish;
var timerSeconds;
function drawTimer(percent){
	$('div.timer').html('<div id="slice"'+(percent > 50?' class="gt50"':'')+'><div class="pie"></div>'+(percent > 50?'<div class="pie fill"></div>':'')+'</div>');
	var deg = 360/100*percent;
	$('#slice .pie').css({
		'-moz-transform':'rotate('+deg+'deg)',
		'-webkit-transform':'rotate('+deg+'deg)',
		'-o-transform':'rotate('+deg+'deg)',
		'transform':'rotate('+deg+'deg)'
	});
	$('.percent').html(Math.round(percent)+'%');
}
function stopWatch(){
	var seconds = (timerFinish-(new Date().getTime()))/1000;
	if(seconds <= 0){
		drawTimer(100);
		clearInterval(timer);
		//$('input[type=button]#watch').val('Start');
		$('.timer').hide();

	}else{
		var percent = 100-((seconds/timerSeconds)*100);
		drawTimer(percent);
	}
}
$(document).ready(function(){

	$('.downloadButton-base').click(function(e){
		e.preventDefault();
		$('.downloading').show();
		$('.timer').show();
		$('input[type=button]#watch').val('Stop');
		timerSeconds = 3;
		timerCurrent = 0;
		timerFinish = new Date().getTime()+(timerSeconds*1000);
		timer = setInterval('stopWatch()',50);
	});

});
              
            
!
999px

Console