2

I have develop some html page. I want to fit side menu when change page div height

<div>  <!-- menu div-->
</div> 
<div>  <!-- content div-->
</div>

When change content div height, want to change same height in menu div. When show hidden field change content div height, I want to adjust menu div height in same height. I looking for answer in jquery or JavaScript.

Thilina Sampath
  • 3,615
  • 6
  • 39
  • 65

2 Answers2

2

See about https://api.jquery.com/resize/ and http://api.jquery.com/height/

$('div').height();

or

$('div').resize();
1

You can use bind/trigger for that:

$('#content-div').bind('heightChange', function(event, newHeight){
  $('#main-div').height(newHeight);
});

and trigger event on div height change:

var newHeight = 200;
$('#content-div').css('height', newHeight);
$("#content-div").trigger('heightChange', newHeight);
Alexey G
  • 1,068
  • 1
  • 14
  • 18