This is the situation:
I have a blog with several posts. Each post has images inside of it. With jQuery I am alreay wrapping the first image of each post so I can give it a unique styling.
Next to the styling I would also like to grab the first image of a post and use it as the header. The header already has a background so it should be replaced by, indeed, the first image of a post.
if ($("body").is("#permalink") && $(".imgwrapper").length>0) {
var firstImage = $(".imgwrapper").attr('src')
$('#header-bg').css('background-image', "url(" + firstImage + ")")
}
Somehow the above code is not working and is giving me the following error in the console: resource interpreted as image but transferred with mime type text/html
Your help is much appreciated!