Tiggles ツ
3/19/2019 - 2:01 PM

Default Hero Background Image

This will allow users to drag n drop images into a hero content area, and have that image become the banner background. Also removes p tags that linger.

// replace this selector with your hero image .templatecontent's parent
$("body.default .section-hero .slider").each(function() {
    var img = $(this).find(".templatecontent img");
    var pTag = $(this).find(".templatecontent p");
    if (img.attr("src") !== undefined) {
      $(this).css({
        "background-image": "url(" + img.attr("src") + ")",
        });
      img.remove();
    }
    
    // get rid of the pesky p tags
    if (pTag.length) {
      pTag.remove();
    }
  });