Global Elements
2
Footer Header Services Strip Services Tabs
Components
36
Card Carousel Cards Grid Content Overlap Content Strip Cta Bar Featured Article Featured Blocks Featured Expert Featured Pods Featured Tabs Form Block Full Screen Carousel Full Width Content Heading Strip Hero Hero Featured Links List Location Tabs Logo Carousel Map Block People Grid Quote Block Reviews Carousel Reviews Tabs Service Tiles Services Strip Services Tabs Staggered Content Sticky Accordion Sticky List Sub Navigation Team Carousel Team Filters Team Strip Tile Carousel Tile Grid

Tile Carousel

Field
Field Type
Field Name
Instructions
Block Data
tab
Heading Type
select
heading_type
Heading Text
text
heading_text
Copy
wysiwyg
copy
Buttons
repeater
buttons_list
-- Button
link
button
Featured Items
relationship
featured_items
Block Meta
tab
ID
text
block_id
Block Classes
text
block_classes
Block Theme
select
block_theme
Background Colors
select
background_colors
Padding Top
select
padding_top
Padding Bottom
select
padding_bottom
Margin Top
select
margin_top
Margin Bottom
select
margin_bottom

				
@import "../../resources/scss/util/colours";
@import "../../resources/scss/util/variables";
@import "../../resources/scss/util/mixins";

.block-tile-carousel {
	background-color: $veryLightBlue;
	padding-top: rem-calc(80);
	padding-bottom: rem-calc(80);
	overflow: hidden;

	.heading {
		@include fluid-type(28, 34);
	}

	.swiper {
		overflow: visible;
	}

	.swiper-slide {
		@include bp($lg) {
			width: auto !important;
		}

		&:nth-of-type(even) {
			.block-tile-carousel__tile {
				background-color: $navy;
			}
		}
	}

	&__intro {
		margin-bottom: rem-calc(48);
	}

	&__buttons {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;

		@include bp($lg) {
			justify-content: flex-end;
			width: auto;
		}
	}

	&__tile {
		display: block;
		background-color: $blue;
		color: $white;
		text-decoration: none;
		@include fluid-type(20, 24);
		font-weight: 700;
		padding: rem-calc(24);
		height: 100%;
		min-height: rem-calc(215);
		width: auto !important;
		max-width: none;
		position: relative;
		transition: all 0.2s ease-in-out;

		@include bp($lg) {
			width: rem-calc(275) !important;
			max-width: rem-calc(275);
		}

		&:after {
			content: '';
			position: absolute;
			bottom: rem-calc(24);
			left: rem-calc(24);
			width: rem-calc(40);
			height: rem-calc(40);
			border-radius: 50%;
			border: 1px solid $white;
			background-image: url('#{$asset-path}/icons/icon-full-arrow-right-white.svg');
			background-size: 50%;
			background-position: center;
			background-repeat: no-repeat;
		}

		&:hover {

			&:after {
				border: 1px solid $orange;
				background-image: url('#{$asset-path}/icons/icon-full-arrow-right-orange.svg');
			}
		}
	}
}
class TileCarousel {
	/**
	 * Create and initialise objects of this class
	 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor
	 * @param {object} block
	 */
	constructor() {
		this.blocks = document.querySelectorAll('.block-tile-carousel');
		this.init();
	}

	/**
	 * Example function to run class logic
	 * Can access `this.block`
	 */
	init() {
		this.blocks.forEach((block) => {

			const blockCarousel = block.querySelector(".swiper");
			const navNext = block.querySelector(".e-carousel__next");
			const navPrev = block.querySelector(".e-carousel__prev");

			const swiper = new Swiper(blockCarousel, {
				loop: false,
				slidesPerView: 1.5,
				spaceBetween: 24,
				navigation: {
					nextEl: navNext,
					prevEl: navPrev,
				},
				// speed: 3000,
				breakpoints: {
					992: {
						slidesPerView: 'auto',
					},
					// 992: {
					// 	slidesPerView: 5,
					// }
				}
			});

			// Staggered reveal animation
			const staggeredCards = document.querySelectorAll(".st-stagger-reveal");

			if (staggeredCards !== null)  {
				gsap.set(".st-stagger-reveal", {y: 100});

				ScrollTrigger.batch(".st-stagger-reveal", {
					start: "top 100%",
					onEnter: batch => gsap.to(batch, {opacity: 1, y: 0, stagger: 0.15, overwrite: true}),
					onLeave: batch => gsap.set(batch, {opacity: 0, y: -100, overwrite: true}),
					onEnterBack: batch => gsap.to(batch, {opacity: 1, y: 0, stagger: 0.15, overwrite: true}),
					onLeaveBack: batch => gsap.set(batch, {opacity: 0, y: 100, overwrite: true})
				});

				ScrollTrigger.addEventListener("refreshInit", () => gsap.set(".st-stagger-reveal", {y: 0}));
			}

		});
	}
}

new TileCarousel();

Animation / States

  • As the user scrolls to this component the copy and each tile will be lazyloaded fade in one by one
  • On hover, if the item has a featured image assigned to it, it will fade in within the background
  • The user will be able to navigate the carousel by using the arrow indicators
  • The carousel will overflow on the right hand side of the screen

External Libraries

  • Swiper
  • ScrollTrigger (GSAP)

Notes (Design / Dev / SEO)

None