A Pen by Captain Anonymous on CodePen.
Created
November 20, 2014 14:28
-
-
Save anonymous/d068f61218e7a42a0362 to your computer and use it in GitHub Desktop.
LEEeXJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="http://cloudcannon.com/img/blog/deconstructions/crisp-golden-gate.jpg" /> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blurImages = function () { | |
$('img').each(function () { | |
var offset = $(this).offset(); | |
offset.top += $(this).outerHeight() / 2; | |
var centerOfTheScreen = window.scrollY + $(window).height() / 2; | |
var distanceFromCenter = Math.abs(centerOfTheScreen - offset.top); | |
var blurFraction = (Math.min(distanceFromCenter, 300) / 300); | |
$(this).css('-webkit-filter', 'blur(' +(10 * blurFraction)+ 'px)') | |
}); | |
}; | |
$(window).on('scroll', blurImages); | |
$(document).ready(blurImages); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img { | |
margin: 1000px 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment