Created
August 24, 2015 09:49
-
-
Save paaljoachim/d286df6f1fd57baaca3e to your computer and use it in GitHub Desktop.
Creating a sticky header.
This file contains 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
// Adding code to create an effect on the header/nav on scroll | |
jQuery(function( $ ){ | |
if( $( document ).scrollTop() > 0 ){ | |
$( '.site-header' ).addClass( 'dark' ); | |
} | |
// Add opacity class to site header | |
$( document ).on('scroll', function(){ | |
if ( $( document ).scrollTop() > 0 ){ | |
$( '.site-header' ).addClass( 'dark' ); | |
} else { | |
$( '.site-header' ).removeClass( 'dark' ); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment