header fixed adjust height with script

HTML
<div class="container"> <div class="row"> <h2>when fixed container Adjust Container Height in header-push</h2> </div> </div> <div class="header-push"></div> <h1>Now Check it</h1>
CSS
.container{ position:fixed; top:0; width:100%; background-color:#aeaeae; } .container h2{ margin:0; padding:10px; }
Javascript
function resizeHeader() { $(".header-push").height($(".container").height()); } $(document).ready(resizeHeader); $(window).resize(resizeHeader);