This is my website.
I want the background of my nav-element to be blurred... I used html2canvas and stackblur for this, and you can find the tutorial here.
My problem is now that I want to exclude the nav-element from being rendered in canvas, so it only shows the background when scrolling. Currently it’s only working in WebKit browsers, because I don’t know how to add multiple properties to:
"-webkit-transform",
This is my code:
<script>
$(function () {
html2canvas($("body"), {
onrendered: function (canvas) {
$("div.blurnav, div.blurnav.small").append(canvas);
$("canvas").attr("id", "canvas");
stackBlurCanvasRGB(
'canvas',
0,
0,
$("canvas").width(),
$("canvas").height(),
20);
}
});
vv = setTimeout(function () {
$("body").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)");
});
</script>