So the classic way of doing fluid images is with the max-width/height combo on the img css.
img { max-width:100%; height: auto;}
however I am in a situtation where I actually want the image to resize based on the containter's height limitation and not its width. I thought that a simple swap of properties would do the trick, but apparently it is not that simple. Check the fiddle bellow. If I set the container (wrap)'s width to a fixed pixel dimension, the image works as it should. However, if I change the img css to
img { max-height:100%; width: auto;}
and force a pixel height, nothing really happens.
jsfiddle: see updates bellow
Just to give you a little more insight of what I am trying to achieve. I will have a number of full-window containers one on top of each other. Each container should take the whole window space. This is why I need the image to flex its dimensions depending on the container height (I am aware I may have to resort to jquery to force the container's height).
thanks for any insight
update!
I have created two fiddles to better illustrate my ultimate goal.
I want to be able to stack containers that are each as tall as the whole window. Scaling the image up or down fluidly to help achieve this.
fiddle1: wrapper element is set to 100% width+height. if width is reduced, the image fluidly resizes.
fiddle2: wrapper element is set to a given pixel height. I would expect/imagine/cross my fingers that image would resize fluidly too fitting in all the content and the container's set height be respected. This however does not happen.
http://jsfiddle.net/1geyww63/4/
I hope I have made myself more understandable. I didn't want to throw too much information there. My main question remains how to make images resize fluidly with a height "centric" approach as opposed to the width.

I guess you can use positions.
You have to set wrapper for relative and img for absolute position:
http://goo.gl/n5CkRx simple example