Use outerHeight() instead of height() so it gets a more accurate measurement of the elements height. Also added some comments.