Advertisement
jamespaulsandel

WP Sticky Nav

Oct 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $(window).scroll(function() {
  2.         if($('#wpadminbar').length) {
  3.             var ht = 101;
  4.         } else {
  5.             var ht = 133;
  6.         }
  7.         if($(window).scrollTop() > ht) {
  8.             var css = {
  9.                 position : 'fixed',
  10.                 top : -ht + 'px',
  11.                 right : 0,
  12.                 width : '100%',
  13.                 'z-index' : 9999
  14.             };
  15.             $('body > header').css(css);
  16.         } else {
  17.             $('body > header').css('position', 'static');
  18.         }
  19.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement