Advertisement
jegtheme

example

Jul 28th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sidebar_share_sticky() {
  2.  
  3.         var top = 20;
  4.         var cachetop = top;
  5.         var navbar = $('.jeg_navbar_wrapper');
  6.         var ww = $(window).width();
  7.  
  8.         var do_sticky = function() {
  9.             var st = $(window).scrollTop();
  10.  
  11.             // is navbar sticky
  12.             if(st == 0) {
  13.                 if(navbar.position().top === 0) {
  14.                     if ( st > navbar.outerHeight()) {
  15.                         top = 70;
  16.                     }
  17.                 }
  18.             }
  19.  
  20.             if(ww >= 767 && cachetop !== top)
  21.             {
  22.                 $('.jeg_sticky_sidebar').addClass('normalize-top');
  23.                 $('.share-float').addClass('normalize-top');
  24.             }
  25.  
  26.         };
  27.  
  28.         $(window).bind('scroll', do_sticky);
  29.         $(window).bind('resize', function(){
  30.             ww = $(window).width();
  31.         })
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement