Make all user uploaded images responsive
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
// 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}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)