<div class="splash-image-wrap splash-image">
<img class="splash-image-bg" src="http://mysite-com/image.jpg" alt="image-bg">
</div>
Can you help me with a script that adds the img src url as image background for the wrap div?
I'm trying this but does not work
$(function () {
function updatePageForTopImg(){
// background image using size cover
// top background image
$('.splash-image-wrap').css('background-image', 'url('+$(".splash-image-bg").attr("src")+')').css('background-size' , 'cover').css('background-position' , 'top center');
}
$(window).on('load', function(){
updatePageForTopImg();
});
});