michael2
9/11/2017 - 12:36 AM

This converts the image in the #subBanner into a background image

This converts the image in the #subBanner into a background image

<script>
  // SET SUBBANNER IMG TO BACKGROUND-IMAGE
  $(document).ready(function() {
if($('#subBanner .container').find('img').length) {
      $('#subBanner .container').find('img').each(function(n, image){
      var image = $(image);
      var thisurl = $(this).attr('src');
      image.parents('.container').css('background-image', 'url(' + thisurl + ')');
    });
} else {
      $('#subBanner .container').css('background-image', 'url(' + '/thumbnaillarge/sl1.jpg' + ')');
}
  });
</script>