@Onheiron, your post was extremely helpful. Thanks!
I added a line to my code because I noticed that short pages of content do not extend completely to the bottom of the page and make the sidebar remain short. Now the script checks to see if one (.content or body) has a large height, and then applies the same height to the .sidebar .
HTML
<body> <div class="sidebar"></div> <div class="content"></div> </body>
Javascript
$(document).ready(function () { var height1 = $('.content').height() var height2 = $('body').height() if (height1 > height2) { $('.sidebar').height(height1) } else { $('.sidebar').height(height2) } });
CSS
body, .sidebar { height:100% }
Then lose the else part of the if statement as it will be the default for css. There is no need for a script if the .content area .content smaller than the body.
Ryan labelle
source share