function adjustHeight(){
var headerHeight=$(element).find('.header').outerHeight();
console.log(headerHeight);
var temp=$(window).height()-headerHeight;
console.log(temp);
$('.users').height(temp);
}
calling it once initially and when resizing the window
the height of the .sers element is always 30 pixels larger than the held temporary variable.
$('.users').css('height',temp+'px');
This works fine as expected.
<div class="mainPage" data-bind="visible:mode() === 'authenticated',handleHeightOfElements:''">
<div class="header">
<div>
This is header text
</div>
</div>
<div class="mainBody">
<div class="users">
All users:
<div data-bind="foreach:userList">
<div class="user">
<span data-bind="text:$data.userName,css:{onlineUser:$data.online()}">
</span>
</div>
</div>
</div>
.users{
float: left;
width: 140px;
background: antiquewhite;
padding: 15px;
box-sizing:border-box;
}
source
share