Skip to content

Instantly share code, notes, and snippets.

@daltonrooney
Created February 9, 2012 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daltonrooney/1784053 to your computer and use it in GitHub Desktop.
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
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