You can do this in CSS my good sir. It's called responsive design!
@media (max-height:500px) {
Enter special css conditions for 500px height.
}
@media (max-height:200px) {
Enter special css conditions for 200px height.
}
This is more commonly used for max-width because it can tell us when someone is using a mobile device (something like 360px max-width), then we can modify our page to look nice on mobile. No fancy javascript needed!