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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="bokeh.css">
    </head>
    <body>
        <canvas id="canvas"></canvas>
        <section id="bokeh">
            <h1>Bokeh Modal</h1>
            <p>This is bokeh modal, made with canvas and CSS3 filters.</p>
            <p>The blur effect only works in Webkit :( I'm just adding some classes and removing some classes on click, so there's not really any wizardry going on.</p>            
            <a href="#" id="launch">Go Go Go!</a>
        </section>
        <section id="modal">
            <div class="modalContent">Is it me you're looking for?</div>
        </section>
        <script src="bokeh.js"></script>
    </body>
</html>
              
            
!

CSS

              
                //Mixins
.scale(@ratio:1.5) {
		-webkit-transform:scale(@ratio);
		-moz-transform:scale(@ratio);
		transform:scale(@ratio);
}

.transition(
	@speed: 0.5s, 
	@properties: all,
	@easing: ease
	) {
		-webkit-transition: @properties @speed @easing;
		-moz-transition: @properties @speed @easing;
		-o-transition: @properties @speed @easing;
		-ms-transition: @properties @speed @easing;
		transition: @properties @speed @easing;
}

.blur(@amount) {
	-webkit-filter: blur(@amount);
	-moz-filter: blur(@amount);
}

body {
	font: 16px "Helvetica Neue", Arial, sans-serif;
	overflow: hidden;
	background: #333;
  line-height: 1.4;
}


#bokeh {
	.transition();
	width: 100%;
	max-width: 600px;
	margin: 50px auto 0;
	padding: 1.5em 2em ;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	background: fade(#222, 90%);
	border: 1px solid #111;
	color: white;
	border-radius: 5px;
	box-shadow: 0 1px 2px fade(black, 20%), 
              inset 0 1px 0 fade(white, 10%);
	h1 {
		font-size: 2em;
		margin: 0;
	}
	#launch {
		margin: 20px auto; 
		display: block;
		width: 120px;
		text-align: center;
		font-size: 1em;
		font-weight: bold;
		text-decoration: none;
		background: #3D3DCC; 
		border: 1px solid #111;
		padding: 0.75em 1em;
		border-radius: 3px;
		text-shadow: 0 1px 0 fade(black, 20%);
		color: #EEE;
		box-shadow: inset 0 1px 0 fade(white, 20%);
		&:hover {
      cursor: pointer; 
      background-color: lighten(#3D3DCC, 10%);
    }
	}
}
#modal {
	  opacity: 0;
	  .transition();
	  background: fade(#111, 50%);
    position: absolute;
    left: 0px;
    top: 0px;
    width:100%;
    height:100%;
    text-align:center;
    z-index: -1;
}
#modal .modalContent{
	.transition();
	width: 20%;
	margin: 150px auto;
	padding: 2em 2.5em;
	background: fade(black, 80%);
	color: white;
	box-shadow: 0 1px 2px fade(black, 20%);
	border-radius: 5px;
}
#modal.visible {
	display: block;
	.blur(0);
	opacity: 1;
	z-index: 1000;
}

//The Magic
.blur {
	.blur(30px);
	.scale(1.05);
}
#canvas {
	position: absolute;
  background-image: url('https://subtlepatterns.com/patterns/debut_dark.png');
	top: 0;
	left: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	.blur(10px);
	.transition();
	.scale(1.5);
	&.blur-less {
		.blur(0);
		.scale(1);
	}
}

@media only screen and (max-width: 800px) {
	#bokeh {width: 80%;}
	#modal .modalContent {width: 60%;}
}
              
            
!

JS

              
                function addBokeh() {
	document.getElementById("bokeh").className = "blur";
	document.getElementById("canvas").className = "blur-less";
	document.getElementById("modal").className = "visible";
};

function removeBokeh() {
	document.getElementById("bokeh").className = document.getElementById("bokeh").className.replace(/(?:^|\s)blur(?!\S)/g , '');
	document.getElementById("canvas").className = document.getElementById("canvas").className.replace(/(?:^|\s)blur-less(?!\S)/g , '');
	document.getElementById("modal").className = document.getElementById("modal").className.replace(/(?:^|\s)visible(?!\S)/g , '');
};

function gogogo() {
	document.getElementById("launch").addEventListener( 'click' , addBokeh );
	document.getElementById("modal").addEventListener( 'click' , removeBokeh );
}

//	window.addEventListener('resize', resizeCanvas, false);
	
	/*function resizeCanvas() {
	        canvas.width = window.innerWidth;
	        canvas.height = window.innerHeight;
	        drawCanvas(); 
	}
	resizeCanvas();
	
	function drawCanvas() {
		for (i = 1; i <= 100; i++) {
			var canvas = document.getElementById('canvas');
		    var context = canvas.getContext('2d');
		    
		    var randomize = Math.floor(Math.random() * 150) + 1;
		    var r = randomize;
		    var g = randomize;
		    var b = randomize;
		    var randomColor = 'rgba(' + b + ',' + b + ',' + b + ', 0.8)';

		    var width = Math.floor(Math.random() * canvas.height * 5 );
		    var height = Math.floor(Math.random() * canvas.height);
		    var radius = Math.floor(Math.random() * 100);
	
		    var circles = function() {
		        context.beginPath();
		        context.arc(width, height, radius, 0, 2 * Math.PI, false);        
		        context.fillStyle = randomColor;
		        context.fill();
		    };

			circles();
		};
	};
};
*/
gogogo()
              
            
!
999px

Console