find an image contained within markup tree, remove said image, and apply it to the parent that has the bg-img
class
$(".bg-img").each(function() {
var img = $(this).find("img");
$(this).css({
"background-image": "url(" + img.attr("src") + ")",
"background-position": "center top",
"background-size": "cover",
"background-repeat": "no-repeat",
"width": "100%"
});
img.remove();
});