Jamoverjelly
11/3/2018 - 5:05 PM

Sass: Adding a Background

// declare new mixin called background
@mixin background {
  // check if variable is true
  @if $show-home-img {
	&#bg-img {
	  background: $home-image;
	  background-attachment: fixed;
	  background-size: cover;
	  
	  // use CSS pseudo-element to add overlay
	  &:after {
	  content: '';
		position: absolute;
		top: 0;
		right: 0;
		width: 100%;
		height: 100%;
		z-index: -1;
		background: rgba($primary-color, $background-opacity);
	  }
	}
  }
}