Have been trying to reduce the size of my header on scroll using the info from here:
jQuery - Sticky header that shrinks when scrolling down.
However, while the header stays fixed, it's not shrinking when I scroll down.
This is what I have in my js file:
$(function(){
  $('#header').data('size','big');
});
$(window).scroll(function(){
  if($(document).scrollTop() > 0)
{
    if($('#header').data('size') == 'big')
    {
        $('#header').data('size','small');
        $('#header').stop().animate({
            height:'40px'
        },600);
    }
}
else
  {
    if($('#header').data('size') == 'small')
      {
        $('#header').data('size','big');
        $('#header').stop().animate({
            height:'120px'
        },600);
      }  
  }
});
Can someone help me figure out why it's not working?
I'm using the latest Wordpress and have enqueued the script in my theme's functions file - don't know if this info helps, but just wanted to give as much info as possible to get my issue resolved.
 
     
     
    