jquery to solve the 100% height problem

January 12th, 2010
By: Cory Mathews

Real short post today just a quick snippet of jQuery that solves the 100% height problem.

Yes there are complete CSS solutions to this but it seems that at times they can be problematic, and at other times laziness can kick in.

$(document).ready(function () {
    $("#divID").height($(document).height());
});

//And the slightly more fancy way. With a subtle slide down.

$(document).ready(function () {
    $("#divID").animate({ height: $(document).height() }, 500 );
});