Monthly Archives: December 2014

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
%d bloggers like this: