Check for the height inside the hover function.
secondary.hover(function(){ if (secondary.height() <= 300) { jQuery('.comments-holder').css("height",mediumHeight); } }, function(){ if (secondary.height() <= 300) { jQuery('.comments-holder').css("height",minHeight); } });