Is it possible to have a floating footer that ONLY floats if all page content is on-screen?

I believe this is similar to another post but with more of an emphasis on “conditional” behavior rather than simply sticking the footer to the bottom.