update_hash('lifestyle'); $('.lifestyle_shot img').each(function(){ var orgWidth = $(this).width(); var orgHeight = $(this).height(); var holderWidth = $(this).parent().parent().width(); var holderHeight = $(this).parent().parent().height(); var newRatio = holderWidth/orgWidth; if(orgHeight*newRatio