jQuery multiple else if statements <p>I am trying to set a padding on a div based on the window height size. I simply couldn't find a better working way to center my content div vertically in another div with unknown dimensions. My code is as it follows:</p> <pre><code>&lt;script&gt; $(document).ready(function(){ var window_height = $(window).height(); var home_content = $('#home-content'); if(window_height &lt;= 600) { home_content.css({"padding-top", "13px"}); } else if(window_height &gt; 600 &amp;&amp; window_height &lt;= 768) { home_content.css({"padding-top", "97px"}); } else if(window_height &gt; 768 &amp;&amp; window_height &lt;= 800) { home_content.css({"padding-top", "113px"}); } else if(window_height &gt; 800 &amp;&amp; window_height &lt;= 900) { home_content.css({"padding-top", "163px"}); } else if(window_height &gt; 900 &amp;&amp; window_height &lt;= 1050) { home_content.css({"padding-top", "238px"}); } else if(window_height &gt; 1050 &amp;&amp; window_height &lt;= 1080) { home_content.css({"padding-top", "253px"}); } else if(window_height &gt; 1080 &amp;&amp; window_height &lt;= 1200) { home_content.css({"padding-top", "313px"}); } else { } }); &lt;/script&gt; </code></pre> <p>It is not working. My web site is stuck on the preloader and simply won't load anyhing. Any ideas where am I doing it wrong?</p>