Tiggles ツ
11/1/2018 - 1:55 PM

bg-img.js

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();
});