$(window).bind("load resize", function() {
var fluid = $(".container").width();
$(".container img").width(fluid).height("auto");
});
This bit of code is specially useful when working with fluid layouts, where container’s width vary depending on viewers screen resolution. The key here is ‘.height(“auto”)’. Without it, we would get the same result as if we used “width: 100%” on css. Keep reading