Hero Carousel (Homepage)
<div class="hero-carousel-wide js-hero-carousel-wide">
<div class="hero-carousel-wide__slides js-slides">
<!-- Slide 1 -->
<div class="hero-carousel-wide__slide">
<div class="hero-carousel-wide__item" style="background-image: url(/images/hero-demo-0.jpg)">
<div class="hero-carousel-wide__content-wrapper">
<div class="hero-carousel-wide__content">
<div class="hero-carousel-wide__title-wrap">
<h1 class="hero-carousel-wide__title">Lorem ipsum dolor sit amet consectetur adipisicing elit</h1>
</div>
<div class="hero-carousel-wide__actions btn-group-split">
<a href="#" class="btn btn-primary">Primary Link</a>
<a href="#" class="btn btn-default">Secondary Link</a>
<a href="#" class="btn btn-link">Tertiary Link</a>
</div>
</div>
</div>
</div>
</div>
<!-- /Slide 1 -->
<!-- Slide 2 -->
<div class="hero-carousel-wide__slide">
<div class="hero-carousel-wide__item" style="background-image: url(/images/hero-demo-1a.jpg)">
<div class="hero-carousel-wide__content-wrapper">
<div class="hero-carousel-wide__content">
<div class="hero-carousel-wide__title-wrap">
<h1 class="hero-carousel-wide__title">Ratione atque nisi neque similique culpa corrupti voluptatum</h1>
</div>
<div class="hero-carousel-wide__actions btn-group-split">
<a href="#" class="btn btn-primary">Primary Link</a>
<a href="#" class="btn btn-default">Secondary Link</a>
<a href="#" class="btn btn-link">Tertiary Link</a>
</div>
</div>
</div>
</div>
</div>
<!-- /Slide 2 -->
<!-- Slide 3 -->
<div class="hero-carousel-wide__slide">
<div class="hero-carousel-wide__item" style="background-image: url(https://via.placeholder.com/1170x530/013f8c/1475ff)">
<div class="hero-carousel-wide__content-wrapper">
<div class="hero-carousel-wide__content">
<div class="hero-carousel-wide__title-wrap">
<h1 class="hero-carousel-wide__title">Vel dolorum placeat deleniti nostrum molestias at voluptatem</h1>
</div>
<div class="hero-carousel-wide__actions btn-group-split">
<a href="#" class="btn btn-primary">Primary Link</a>
<a href="#" class="btn btn-default">Secondary Link</a>
<a href="#" class="btn btn-link">Tertiary Link</a>
</div>
</div>
</div>
</div>
</div>
<!-- /Slide 3 -->
</div>
<div class="hero-carousel-wide__controls">
<button type="button" class="carousel-arrow carousel-prev js-carousel-prev">Previous</button>
<div class="carousel-dots-wrapper js-carousel-dots"></div>
<button type="button" class="carousel-arrow carousel-next js-carousel-next">Next</button>
</div>
</div>
.hero-carousel-wide {
color: $color-base-white;
position: relative;
margin: 0 auto 2.4rem;
@media (min-width: $breakpoint-tablet) {
max-width: 940px;
}
@media (min-width: $breakpoint-desktop) {
max-width: 1170px;
}
.carousel-dots-wrapper {
margin: 0 0.8rem;
}
.carousel-dots {
padding: 0;
margin: 0;
list-style: none;
li {
position: relative;
display: inline-block;
margin: 0;
padding: 0;
cursor: pointer;
button {
font-size: 0;
line-height: 0;
display: block;
padding: 0.8rem;
cursor: pointer;
color: transparent;
border: 0;
outline: none;
background: transparent;
&:hover,
&:focus {
outline: none;
}
&::before {
font-family: "FontAwesome";
font-size: 1.6rem;
line-height: 1;
content: "\f10c";
text-align: center;
opacity: 0.5;
color: $color-base-white;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
&:hover::before,
&:focus::before {
opacity: 1;
}
}
}
li.slick-active button::before {
opacity: 1;
color: $color-base-white;
content: "\f111";
}
}
.carousel-arrow {
z-index: 1;
font-size: 0;
line-height: 0;
display: block;
padding: 0.8rem;
cursor: pointer;
color: transparent;
border: none;
outline: none;
background: transparent;
&::before {
font-family: "FontAwesome";
font-size: 1.6rem;
line-height: 1;
opacity: 0.75;
color: $color-base-white;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
&:hover,
&:focus {
color: transparent;
outline: none;
background: transparent;
&::before {
opacity: 1;
}
}
}
.carousel-prev::before {
content: "\f177";
}
.carousel-next::before {
content: "\f178";
}
}
.hero-carousel-wide__controls {
position: absolute;
bottom: 0;
width: 100%;
height: 3.2rem;
display: inline-flex;
justify-content: center;
}
.hero-carousel-wide__item {
display: flex;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
min-height: 24rem;
padding-bottom: 3.2rem;
position: relative;
@media (min-width: $breakpoint-tablet) {
min-height: 42rem;
}
@media (min-width: $breakpoint-desktop) {
min-height: 53rem;
}
}
.hero-carousel-wide__content-wrapper {
width: 100%;
max-width: 1170px;
margin: 0 auto;
display: flex;
position: absolute;
top: 0;
left: 0;
height: 100%;
z-index: 1;
align-items: center;
}
.hero-carousel-wide__content {
margin: 0 2.4rem;
text-align: center;
@media (min-width: $breakpoint-tablet) {
text-align: left;
width: 50%;
}
}
.hero-carousel-wide__title-wrap {
display: flex;
margin-bottom: 1.2rem;
}
.hero-carousel-wide__title {
@include typeHeadline(true);
@media (min-width: $breakpoint-tablet) {
@include typeDisplay(true);
}
@media (min-width: $breakpoint-desktop) {
@include typeDisplayLarge;
}
}
$(document).ready(function () {
$(".js-hero-carousel-wide").each(function () {
const $component = $(this);
$component.find(".js-slides").slick({
autoplay: false,
dots: true,
dotsClass: "carousel-dots",
appendDots: $component.find(".js-carousel-dots"),
prevArrow: $component.find(".js-carousel-prev"),
nextArrow: $component.find(".js-carousel-next"),
});
});
});