iOS7 Frosted Glass Effect

by CSS_Apprentice

HTML

<script src="https://rawgithub.com/abduzeedo/ios7-blur-html5/master/js/html2canvas.js"></script>
<script src="https://rawgithub.com/abduzeedo/ios7-blur-html5/master/js/StackBlur.js"></script>
<section>
    <header></header>

<ul id="navbar">
	<li><a href="#">Home</a></li>
	<li><a href="#">About</a></li>			
	<li><a href="#">Portfolio</a></li>
	<li><a href="#">Blog</a></li>
	<li><a href="#">Contact</a></li>
</ul>
    
    <div class="blurheader"></div>
    <article>
        <img alt=""...

CSS

*, *:after, *:before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
body {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    font-family:"HelveticaNeue-Light", sans-serif;
    background: #ddd;
}

#navbar {
   	width: 75%;
	text-align: justify;
	min-width: 500px;
	margin: 1% auto 0 auto;
	padding: 0;
    z-index: 10000000001;
    position: fixed;
    top: 0;
}

#navbar:after {
    content: '';
    display: inline-block;
    width: 100%;
}

#navbar li {
    display: inline-block;
}

header, .blurheader {
    background: rgba(255, 255, 255, .6);
    height: 88px;
    position: fixed;
    width: 100%;
    top: 0;
    border-bottom:1px solid rgba(0, 0, 0, .2);
    z-index: 10000000000;
}
header {
    text-align: center;
    display: none;
    max-width: 1024px;
}
header h1 {
    font-size: 24px;
    font-family:"HelveticaNeue-Light", sans-serif;
    font-weight: lighter;
    line-height: 88px;
    margin: 0;
    padding: 0;
}
.blurheader {
    background: transparent;
    overflow: hidden;
    z-index: 10000;
    background: #fff;
    left: 0;
}
section {
    height: 100%;
    position: relative;
    display: block;
    max-width: 1024px;
    margin: 0 auto;
    background: #fff;
}
article {
    background: #fff;
    width: 100%;
    padding: 22px;
    margin: 75px 0 0 0;
    z-index: 100;
    font-size: 16px;
    line-height: 150%;
}
#canvas {
    opacity:1;
    z-index: 100;
    position: absolute;
    display: block;
    top: 3px;
}
article h1 {
    font-size: 32px;
    font-family: sans-serif;
    font-weight: bold;
    margin: 0 0 10px 0;
    padding: 0;
    line-height: 32px;
}
article h3 {
    line-height: 24px;
    font-size: 24px;
    margin: 0 0 15px 0;
    padding: 0;
    font-family:"HelveticaNeue-Light", sans-serif;
    font-weight: normal;
}
article p {
    margin: 0 0 15px 0;
}
article img {
    width: 100%;
    margin: 0 0 15px 0;
}
footer {
    margin: 22px -22px -22px -22px;
 ...

JavaScript

$(function () {
    html2canvas($("body"), {
        onrendered: function (canvas) {
            $(".blurheader").append(canvas);
            $("canvas").attr("id", "canvas");
            stackBlurCanvasRGB(
                'canvas',
            0,
            0,
            $("canvas").width(),
            $("canvas").height(),
            20);
        }
    });
    vv = setTimeout(function () {
        $("header").show();
        clearTimeout(vv);
    }, 200);
});

$(window).scroll(function () {
    $("canvas").css(
        "-webkit-transform",
        "translatey(-" + $(window).scrollTop() + "px)");
});

window.onresize = function () {
    $("canvas").width($(window).width());
};

$(document).bind('touchmove', function () {
    $("canvas").css(
        "-webkit-transform",
        "translatey(-" + $(window).scrollTop() + "px)");
});

$(document).bind('touchend', function () {
    $("canvas").css(
        "-webkit-transform",
        "translatey(-" + $(window).scrollTop() + "px)");
});