Created
November 27, 2013 09:26
-
-
Save itsmattsoria/7672974 to your computer and use it in GitHub Desktop.
Easy peasy parralax effect (http://codepen.io/eugene823/pen/vDqkC)
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
function EasyPeasyParallax() { | |
scrollPos = jQuery(this).scrollTop(); | |
jQuery('#banner').css({ | |
'background-position' : 'center ' + (-scrollPos/4)+"px" | |
}); | |
jQuery('#bannertext').css({ | |
'margin-top': (scrollPos/4)+"px", | |
'opacity': 1-(scrollPos/250) | |
}); | |
} | |
jQuery(document).ready(function(){ | |
jQuery(window).scroll(function() { | |
EasyPeasyParallax(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment