Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- ( function( $ ) {
- $( document ).ready( function() {
- if ( $( "body" ).hasClass( 'page-id-39' ) ) {
- var mainHeader = $( '#main-header' ),
- lastScrollTop = 0,
- distance = $( '.show-logo' ).offset().top;
- $( window ).scroll( function( event ) {
- var st = $( this ).scrollTop(),
- wpbarHeight = $( '#wpadminbar' ).height(),
- mainHeaderHeight = mainHeader.height(),
- section = $( '.show-logo' );
- if ( st > lastScrollTop ) {
- if ( mainHeader.hasClass( 'et-fixed-header' ) ) {
- mainHeader.addClass( 'wpc-header' );
- }
- } else {
- if ( mainHeader.hasClass( 'wpc-header' ) ) {
- mainHeader.removeClass( 'wpc-header' );
- }
- }
- lastScrollTop = st;
- if ( st >= distance - ( wpbarHeight + mainHeaderHeight ) ) {
- if ( mainHeader.hasClass( 'wpc-header' ) ) {
- mainHeader.removeClass( 'wpc-header' );
- }
- } else {
- if ( !mainHeader.hasClass( 'wpc-header' ) ) {
- mainHeader.addClass( 'wpc-header' );
- }
- }
- } )
- }
- } );
- } )( jQuery );
- </script>
Advertisement
Add Comment
Please, Sign In to add comment