EduardET

Untitled

May 29th, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2.     $(document).ready(function() {
  3.         function customHeaderFixed(){
  4.             $waypoint_selector = $('#main-content');
  5.             $introDesktopHeight = $('.intro-desktop').height();
  6.             $adminBar = $('#wpadminbar');
  7.  
  8.             if ($adminBar.length) {
  9.                 $introDesktopHeight = $introDesktopHeight - $adminBar.height();
  10.             }
  11.  
  12.             $fullWidthMenu = $('.main_menu');
  13.  
  14.             $waypoint_selector.waypoint( {
  15.                 handler : function( direction ) {
  16.                     if ( direction === 'down' ) {
  17.                         $fullWidthMenu.addClass( 'wpc-fixed-menu' );
  18.                         $('body').addClass('wpc-scrolled');
  19.                         $('#about').css('padding-top', ($fullWidthMenu.height() + $adminBar.height() - 20));
  20.                         if ( $(window).width() <= 980 ) {
  21.                             $('#about').css('padding-top', ($fullWidthMenu.height() + $adminBar.height() - 20));
  22.                             $('#joinus').css('padding-top', ($fullWidthMenu.height() + $adminBar.height()));
  23.                             $('#visitus').css('padding-top', ($fullWidthMenu.height() + $adminBar.height()));
  24.                             $('#contactus').css('padding-top', ($fullWidthMenu.height() + $adminBar.height()));
  25.                         }
  26.                     } else {
  27.                         $fullWidthMenu.removeClass( 'wpc-fixed-menu' );
  28.                         $('body').removeClass('wpc-scrolled');
  29.                         $('#about').css('padding-top', 20);
  30.                     }
  31.                 },
  32.                 offset: -$introDesktopHeight
  33.             } );
  34.         }
  35.         setTimeout(customHeaderFixed, 100);
  36.     });
  37. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment