Fix height on window screen size using jQuery

<script type=’text/javascript’>
jQuery(document).ready(function(){
resizeContent();
jQuery(window).resize(function() {
resizeContent();
});
});

function resizeContent() {
$height = jQuery(window).height();
jQuery(‘.custom-header-img img’).height($height);
}
</script>

In case you have more then one dive so you can also give minus div

<script type=’text/javascript’>
jQuery(document).ready(function(){
resizeContent();
jQuery(window).resize(function() {
resizeContent();
});
});

function resizeContent() {
$height = jQuery(window).height() – jQuery(‘.screenheights’).height();
jQuery(‘.custom-header-img img’).height($height);
}
</script>

<style>
.screenheights {height: 75px;width: 100%;}
</style>

<div class=”container container-medics screenheights”> content </div>

<div class=”custom-header-img”> <img src=”…”> </div>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: