 <p>Try this.</p> <pre><code>$(window).on('scroll', function () { var v = $(window).scrollTop(); if (v &gt; 200) { $('#id-of-div').css({"height": "75px","max-height":"75px"}); } else { $('#id-of-div').css({"height": "150px","max-height":"150px"}); } }); </code></pre> <p>EDIT:</p> <pre><code> $(window).on('scroll', function () { var v = $(window).scrollTop(); if (v &gt; 200) { $('#id-of-div').animate({"height": "75px","max-height":"75px"},500); } else { $('#id-of-div').animate({"height": "150px","max-height":"150px"},500); } }); </code></pre>