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

              
                <!-- This depth of field effect uses SVG filters in CSS3 now works in Chrome and Firefox -->
<div id="photoframe">
<img id="full" src="https://riverabove.com/images/cdpn/full.png" />
<img class="blurable" data-blurindex="10" id="fullblur" src="https://riverabove.com/images/cdpn/full.png" />
<img class="blurable" data-blurindex="8" id="lenses" src="https://riverabove.com/images/cdpn/lens.png" />
<img class="blurable" data-blurindex="6" id="cameras" src="https://riverabove.com/images/cdpn/camera.png" />
<img class="blurable" data-blurindex="4" id="film" src="https://riverabove.com/images/cdpn/film.png" />
<img class="blurable" data-blurindex="2" id="filters" src="https://riverabove.com/images/cdpn/filters.png" />
<img class="blurable" data-blurindex="0" id="loupes" src="https://riverabove.com/images/cdpn/loupe.png" usemap="#loupemap" />
<map id="loupemap" name="loupemap">
<area shape="poly" coords="365,253,365,228,278,194,190,198,187,188,171,182,133,189,81,224,40,263,21,297,21,326,38,332,69,322,93,311,116,295,122,337,348,324,347,260" href="#" alt="filters" title="filters"   />
<area shape="poly" coords="424,423,444,446,490,460,546,464,599,460,632,448,641,437,639,395,628,359,618,334,611,327,617,318,628,256,613,240,601,234,580,230,556,229,543,229,515,230,489,234,469,238,450,253,456,314,460,324,446,348,433,381,426,402" href="#" alt="loupes" title="loupes" />
<area shape="poly" coords="625,287,629,255,616,238,616,168,609,163,610,149,621,145,642,143,647,139,659,137,678,134,702,134,721,136,736,142,736,155,731,159,724,258,722,269,709,273,695,284,677,292,655,292" href="#" alt="film" title="film" />
<area shape="poly" coords="315,93,318,205,361,208,379,220,417,223,448,218,510,222,558,220,574,207,583,163,591,150,591,129,597,102,588,85,587,77,579,75,567,72,565,64,563,62,559,55,548,50,538,47,528,30,519,23,505,22,477,21,443,21,432,23,397,36,388,59,344,62,337,70,323,83" href="#" alt="cameras" title="cameras" />
<area shape="poly" coords="115,175,160,181,173,180,187,183,230,186,259,182,281,154,284,117,270,101,251,92,229,86,203,85,132,83,113,95,98,109,89,133,100,156" href="#" alt="lenses" title="lenses" />
</map>
</div>
<!-- This svg contains the filters used by Firefox to blur the images -->
<svg height="0" xmlns="http://www.w3.org/2000/svg">
  <filter id="blur10" x="0" y="0" width="100%" height="100%">
    <feGaussianBlur in="SourceGraphic" stdDeviation="10"/>
  </filter>
  <filter id="blur8" x="0" y="0" width="100%" height="100%">
    <feGaussianBlur in="SourceGraphic" stdDeviation="8"/>
  </filter>
  <filter id="blur6" x="0" y="0" width="100%" height="100%">
    <feGaussianBlur in="SourceGraphic" stdDeviation="6"/>
  </filter>
  <filter id="blur4" x="0" y="0" width="100%" height="100%">
    <feGaussianBlur in="SourceGraphic" stdDeviation="4"/>
  </filter>
  <filter id="blur2" x="0" y="0" width="100%" height="100%">
    <feGaussianBlur in="SourceGraphic" stdDeviation="2"/>
  </filter>
  <filter id="blur0" x="0" y="0" width="100%" height="100%">
    <feGaussianBlur in="SourceGraphic" stdDeviation="0"/>
  </filter>
</svg>
              
            
!

CSS

              
                body {
    background-color: #3D5461;
}
area :hover {
    cursor: pointer; 
}
/* added the transition as suggested by Jeroen Visser unfortunately this doesn't work with the filter(url) property used by Firefox */
.blurable {
    -webkit-transition: -webkit-filter linear 1s;
}
#photoframe {
    position: relative;
    margin: 0 auto;
    width: 750px;
    height: 491px;
    overflow: hidden;
}
#photoframe img {
    position: absolute;
}
#full {
    -webkit-filter: blur(0px);
    filter: url(#blur0); 
}
#fullblur {
    -webkit-filter: blur(10px);
    filter: url(#blur10); 
}
#lenses {
    -webkit-filter: blur(8px);
    filter: url(#blur8); 
}
#cameras {
    -webkit-filter: blur(6px);
	  filter: url(#blur6); 
}
#film {
    -webkit-filter: blur(4px);
	  filter: url(#blur4); 
}
#filters {
    -webkit-filter: blur(2px);
	  filter: url(#blur2); 
}
#loupes {
    -webkit-filter: blur(0px);
	  filter: url(#blur0); 
}
              
            
!

JS

              
                $(document).ready(function() {
    // detect CSS webkit-filter support in JavaScript, detecting filter returns a false positive
    if (document.createElement("detect").style.webkitFilter === "") {  
        document.getElementById("photoframe").className += "webkit-filter";  
    }
    else {
        document.getElementById("photoframe").className += "filter";  
    };
    $("area").hover(function(){
        var thisTitle = $(this).attr("title");
        var thisBlurIndex = parseInt($("#" + thisTitle).attr("data-blurindex"));
  	    // Apply blur to each image in Firefox
        $(".filter .blurable").each(function(){
            var newBlurIndex = Math.abs(thisBlurIndex - parseInt($(this).attr("data-blurindex")));
            $(this).css("filter","url(#blur" + newBlurIndex + ")");
        });
		    // Apply blur to each image in Chrome
		    $(".webkit-filter .blurable").each(function(){
		    var newBlurIndex = Math.abs(thisBlurIndex - parseInt($(this).attr("data-blurindex")));
            $(this).css("-webkit-filter","blur(" + newBlurIndex + "px)");
        });
    });
});
              
            
!
999px

Console