Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make all user uploaded images responsive
// make all user uploaded images responsive
$(".user_uploaded_content_wrapper img").each(function(){
var oldWidth = ($(this).width() > 0) ? $(this).width()+"px" : '100%';
$(this).css({width:'100%', height:'auto', maxWidth:oldWidth});
});
@micah1701
Copy link
Author

micah1701 commented May 5, 2016

Note, requires an HTML "width" parameter be set on the image if the max-width needs to be less than 100%. (eg, an icon or an image that floats within the copy, even at mobile)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment