Reputation: 3773
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.
Upvotes: 2
Views: 132
Reputation: 1118
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);
Upvotes: 1
Reputation: 168
See about https://api.jquery.com/resize/ and http://api.jquery.com/height/
$('div').height();
or
$('div').resize();
Upvotes: 2