Created
February 11, 2011 16:58
-
-
Save thunsaker/822655 to your computer and use it in GitHub Desktop.
Code to check the current device width and resize the image if it is too wide.
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 reformatImages() { | |
$(document).ready(function () { | |
$('#div_content_inner_wrapper img').each(function () { | |
if ($(this).width() > $('body').width()) { | |
var newWidth = $('body').width() - 30; | |
$(this).css('width', newWidth); | |
} | |
$(this).css("border", "solid 1px gray"); | |
$(this).css("padding", "2px"); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment