title: When images loaded change background, jQuery
body: <p>I'm trying to write a function that once the last image in an element is loaded it sets it as the parents background image only I cant seem to get it working...</p>
  
  <p>I can alert the source but for some reason not affect the parent with no console errors?</p>
  
  <p><a href="https://jsfiddle.net/09ss43nx/1/" rel="nofollow">https://jsfiddle.net/09ss43nx/1/</a></p>
  
  <pre><code>function swapImage(){
  
  var elem = $('.team-member img:last-child');
  if (!elem.prop('complete')) {
    console.log("Waiting to be loaded!");
    elem.on('load', function() {
      elem.parent().css('background-image', elem.attr('src'));
    });
  } else {
    elem.parent().css('background-image', elem.attr('src'));
  }
  
  }
  
  swapImage();
  </code></pre>