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

              
                <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="filters hidden">
			<defs>
				<filter id="blur">
					<feGaussianBlur in="SourceGraphic" stdDeviation="0,0" />
				</filter>
			</defs>
		</svg>
		<div class="container">
			<div class="content">
				<button class="open-modal">Open Modal</button>
			</div>
			<div class="modal-overlay"></div>
			<div class="modal-wrapper">
				<div class="modal js-blur">
					<button class="close-modal">×</button>
					<h2>Heading Text</h2>
					<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis ipsa culpa quidem. Est explicabo architecto vel qui, illo aliquid minima aspernatur unde optio.</p>
				</div>
			</div>
		</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Raleway:300,400,700');

*, *:after, *:before { 
   -webkit-box-sizing: border-box; 
   box-sizing: border-box; 
   outline: none;
}

body {
	background: #212129;
   font-family: 'Raleway', sans-serif;
}

a {
	color: #999;
	text-decoration: none;
}

a:hover, a:focus {
	color: #7D87AE;
}

.hidden {
	position: absolute;
	overflow: hidden;
	width: 0;
	height: 0;
	pointer-events: none;
}

.content {
	text-align: center;
}

.modal-overlay {
/* 	background: rgba(39, 179, 96, 1); */
   background: rgba(33, 33, 61, .5);
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	opacity: 0;
	visibility: hidden;
}

.modal-wrapper {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	overflow: hidden;
	pointer-events: none;
}

.modal {
	background: #fff;
	color: #666871;
	text-align: center;
	width: 400px;
	max-width: 90%;
	height: 250px;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	position: absolute;
	margin: auto;
	padding: 40px;
	pointer-events: auto;
	font-weight: bold;
	visibility: hidden;
}

@media screen and (max-width: 40em) {
	.modal { height: 350px; }
}

.modal h2 {
	font-size: 2.25em;
	margin: 0.5em 0 0.25em;
	color: #BDBFCA;
}

.open-modal {
   text-align: center;
	border: none;
	margin: 10em 0 7em 0;
	background: #27ae60;
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 2px;
	font-size: 20px;
	padding: 1em 2em;
	font-weight: bold;
	border-radius: 40px;
   cursor: pointer;
	-webkit-transition: background 0.3s;
	transition: background 0.3s;
}

.open-modal:hover {
	background: #2ecc71;
}

.close-modal {
	color: #aaa;
	background: none;
	position: absolute;
	top: 10px;
	right: 10px;
	border: none;
	width: 20px;
	height: 20px;
	line-height: 15px;
	font-size: 22px;
	font-weight: bold;
   cursor: pointer;
}

.close-modal:hover {
	color: #666871;
}
              
            
!

JS

              
                (function(){
	var minBlur=2,
        maxBlur=200,
        isUpdatingBlur=false,
        updateBlurStopTimeout=null,
        multiplier=0.25
    ;
        
	$.fn.toggleBlur=function(v){
		var blurId=$(this).data("blur-id");
		var value=v?"url(#"+blurId+")":"none";
		$(this).css({
			webkitFilter:value,
			filter:value
		});
	}
	$.fn.setBlur=function(v){
		var blur=$(this).data("blur");
		v=Math.round(v);
		if($(this).data("blur-value")!=v){
			if(v==0){
				$(this).toggleBlur(false);
			}else{
				$(this).toggleBlur(true);

				blur.firstElementChild.setAttribute("stdDeviation",v+",0");
				$(this).data("blur-value",v);
			}
		}
	}
	$.fn.initBlur=function(_multiplier){
		if(typeof _multiplier=="undefined") _multiplier=0.25;
		multiplier=_multiplier;
		var defs=$(".filters defs").get(0);
		var blur=$("#blur").get(0);
		$(this).each(function(i){
			var blurClone=blur.cloneNode(true);
			var blurId="blur"+i;
			blurClone.setAttribute("id",blurId);
			defs.appendChild(blurClone);
			$(this)
				.data("blur",blurClone)
				.data("blur-id",blurId)
				.data("blur-value",0)
				.data("last-pos",$(this).offset())
			;
		});
	}

	$.updateBlur=function(){
		$(".js-blur").each(function(){
			var pos=$(this).offset();
			var lastPos=$(this).data("last-pos");
			var v=Math.abs(pos.left-lastPos.left)*multiplier;
			$(this).data("last-pos",pos);
			$(this).setBlur(v);
		})
		if(isUpdatingBlur){
			requestAnimationFrame($.updateBlur);
		}
	}
	$.startUpdatingBlur=function(stopDelay){
		if(typeof stopDelay=="undefined"){
			stopDelay=-1;
		}
		if(updateBlurStopTimeout!=null){
			clearTimeout(updateBlurStopTimeout);
			updateBlurStopTimeout=null;
		}
		if(!isUpdatingBlur){
			isUpdatingBlur=true;
			$.updateBlur();
		}
		if(stopDelay>-1){
			updateBlurStopTimeout=setTimeout($.stopUpdatingBlur,stopDelay);
		}
	}
	$.stopUpdatingBlur=function(){
		isUpdatingBlur=false;
	}
})();

// Modal Window
$(document).ready(function() {
    var $modal = $(".modal"),
        $overlay = $(".modal-overlay"),
        blocked = false,
        unblockTimeout=null
    ;

    TweenMax.set($modal,{
    	autoAlpha:0
    })

    var isOpen = false;

    function openModal() {
        if (!blocked) {
        	block(400);

            TweenMax.to($overlay, 0.3, {
                autoAlpha: 1
            });

            TweenMax.fromTo($modal, 0.5, {
                x: (-$(window).width() - $modal.width()) / 2 - 50,
                scale:0.9,
                autoAlpha:1
            }, {
                delay: 0.1,
            	rotationY:0,
            	scale:1,
            	opacity:1,
                x: 0,
                z:0,
                ease: Elastic.easeOut,
                easeParams: [0.4, 0.3],
                force3D: false
            });
        	$.startUpdatingBlur(800);
        }
    }

    function closeModal() {
    	if(!blocked){
    		block(400);
	        TweenMax.to($overlay, 0.3, {
	            delay: 0.3,
	            autoAlpha: 0
	        });
	        TweenMax.to($modal, 0.3,{
	            x: ($(window).width() + $modal.width()) / 2 + 100,
	            scale:0.9,
	            ease: Quad.easeInOut,
	            force3D: false,
	            onComplete:function(){
	            	TweenMax.set($modal,{
	            		autoAlpha:0
	            	});
	            }
	        });
	    	$.startUpdatingBlur(400);
	    }
    }
    function block(t){
    	blocked=true;
    	if(unblockTimeout!=null){
    		clearTimeout(unblockTimeout);
    		unblockTimeout=null;
    	}
    	unblockTimeout=setTimeout(unblock,t);
    }
    function unblock(){
    	blocked=false;
    }
    $(".open-modal").click(function() {
        openModal();
    })
    $(".close-modal,.modal-overlay,.input-submit").click(function() {
        closeModal();
    })

    $modal.initBlur(0.5);

})
              
            
!
999px

Console