Created
February 9, 2012 22:55
-
-
Save daltonrooney/1784053 to your computer and use it in GitHub Desktop.
Resize vertical images max-height based on width of parent container for responsive layouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adaptiveResize() { | |
var $w, $target; | |
$target = $('img'); | |
$target.each(function() { | |
$w = $(this).parent().width(); | |
$target.css('max-height', $w ); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment