EduardET

correct js code

Dec 5th, 2017
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. jQuery( document ).ready( function() {
  3.     var container = jQuery( "#fixed_floating_menu" ),
  4.         menu = jQuery( "#fixed_floating_menu .et_pb_fullwidth_menu" ),
  5.         pos = container.position();
  6.     if ( container.length ) {
  7.         $( window ).scroll( function() {
  8.             var windowpos = jQuery( window ).scrollTop();
  9.             if ( windowpos >= pos.top ) {
  10.                 menu.addClass( "stick" );
  11.                 container.addClass( "hold" );
  12.             } else {
  13.                 menu.removeClass( "stick" );
  14.                 container.removeClass( "hold" );
  15.             }
  16.         } );
  17.     }
  18. } );
  19. </script>
Advertisement
Add Comment
Please, Sign In to add comment