EduardET

Extra delay appearance of the menu

Jan 30th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         setTimeout( function() {
  5.             var header = $( "#main-header" ),
  6.                 firstSectionHeight = $( "#w4pl-list-32159" ).height();
  7.             header.addClass( 'wpc-custom-header' );
  8.             console.log( firstSectionHeight );
  9.             if ( $.fn.waypoint ) {
  10.                 var $waypoint_selector;
  11.                 $waypoint_selector = $( '#page-container' );
  12.                 $waypoint_selector.waypoint( {
  13.                     handler: function( direction ) {
  14.                         if ( direction === 'down' ) {
  15.                             $( '#main-header' ).removeClass( 'wpc-custom-header' );
  16.                         } else {
  17.                             $( '#main-header' ).addClass( 'wpc-custom-header' );
  18.                         }
  19.                     },
  20.                     offset: -firstSectionHeight
  21.                 } );
  22.             }
  23.         }, 100 )
  24.     } );
  25. } )( jQuery );
  26. </script>
Advertisement
Add Comment
Please, Sign In to add comment