I am looking to run a function based on when the background image of the div loads. What am I missing?
JQUERY
$(function () {
$('.productnew .imgframe').each(function () {
$(this).load(function () {
$(this).attr("style", $(this).attr("style").replace("background:", ""));
$(this).attr('style', 'background:url(images/new.png), ' + $(this).attr('style'));
});
});
});
HTML
<div class="poster productnew"><div class="imgframe" style="background:url(images/posters/bicycle.jpg);"></div>