I'm currently working on a website and trying to make it responsive by adjusting to changes in the browser window size. I'm having trouble changing the header height based on the window size unlike how it works for my pictures in CSS:
#logoArea
{
width: 15.625%;
height: auto;
position: absolute;
left: 10%;
}
When I use similar code for the header, it doesn't work as expected:
#header
{
background-color: black;
width: 100%;
height: auto;
}
The height of the header isn't displaying correctly and when inspected, it shows a height of 0px.
I attempted to use jQuery's .resize() as shown below:
<script>
$(document).ready(function(){
$(window).resize(function(){
AdjustHeader();
});
});
function AdjustHeader(){
if (jQuery(window).width() == 1600) {
jQuery("#header").height(200);
}
else
{
jQuery("#header").height(150);
}
}
</script>
This was an experimental test to use jQuery to change the header size. I know it's possible with jQuery.
Question Can anyone assist me in adjusting the header size based on browser window size changes, either in CSS or jQuery? Your help would be greatly appreciated.