Skip to content

Instantly share code, notes, and snippets.

@jtremback
Created August 10, 2013 02:19
Show Gist options
  • Save jtremback/6198753 to your computer and use it in GitHub Desktop.
Save jtremback/6198753 to your computer and use it in GitHub Desktop.
Parralax code from royce haynes
// Functional parallaxing calculations
function slidingTitle() {
//Get scroll position of window
windowScroll = $(this).scrollTop();
//Slow scroll of .art-header-inner scroll and fade it out
$artHeaderInner.css({
'margin-top' : -(windowScroll/3)+"px",
'opacity' : 1-(windowScroll/550)
});
//Slowly parallax the background of .art-header
$artHeader.css({
'background-position' : 'center ' + (-windowScroll/8)+"px"
});
//Fade the .nav out
$nav.css({
'opacity' : 1-(windowScroll/400)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment