Components
48
Background Gradients Breadcrumb Content Card Carousel Content Card Grid Content Cards Two Column Content Contact Form Content Contact Form Reveal Content Courses Map Content Courses Search Content Event Details Content Events Carousel Content Faqs Content Featured Cards Content Featured Products Content Featured Products Carousel Content Form Over Image Content Game Elements Content Hall Of Fame Carousel Content Horizontal Accordion Content Horizontal Scrolling Content How To Find Us Content Job Roles Grid Content Map Embed Content Marquee Text Content Media Carousel Content Players Content Quick Links Content Quote Over Image Content Simple Text And Image Variations Content Specification Content Stat Row Content Stat With Images And Content Content Text And Cards Grid Content Text And Image Variations Content Text Columns Content Text Image Carousel Content Text Over Image Content Title Content Useful Links Content Vacancies Grid Cookie Table Example Hero Basic Hero Featured Card Hero Game Hero Video And Carousel Hero Video Cards Playlist Hero Video Player

Content Media Carousel

There are no ACF fields assigned to this component.

				
@import "../../resources/scss/util/variables";
@import "../../resources/scss/util/mixins";
@import "../../resources/scss/vendor/bootstrap/vendor/rfs";

.block-media-carousel {
	overflow: hidden;
	position: relative;

	&__meta {
		display: flex;
		flex-direction: row;
		gap: rem-calc(16);
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		@include margin-bottom( rem-calc(60) );

		.heading {
			margin-bottom: 0;
		}

		.btn {
			margin-right: 0;
		}
	}

	.swiper {
		overflow: visible;

		&.swiper-initialized {
			display: flex;
		}

		&:not(.swiper-initialized) {
			.swiper-wrapper {
				display: flex;
				flex-direction: row;
				flex-wrap: nowrap;
				gap: rem-calc(30);

				.swiper-slide {
					width: 85%;

					@include bp(600px) {
						width: 85%;
					}

					@include bp(768px) {
						width: 55%;
					}

					@include bp(992px) {
						width: 40%;
					}

					@include bp(1400px) {
						width: 39%;
					}
				}
			}
		}
	}

	.swiper-slide {
		display: flex;
		flex-direction: column;
	}
}
class MediaCarousel {
	/**
	 * @param {object} block
	 */
	constructor( block ) {
		this.block = block;
		this.swiper = null;

		ScrollTrigger.create({
			trigger: this.block,
			start: 'top bottom',
			end: 'bottom top',
			onEnter: () => this.initialiseSwiper(),
		});
	}

	initialiseSwiper() {
		if ( this.swiper ) {
			return;
		}

		this.swiper = new Swiper( this.block.querySelector( '.swiper' ), {
			slidesPerView: 1.25,
			spaceBetween: 30,
			speed: 600,
			navigation: {
				nextEl: this.block.querySelector( '.swiper-button-next' ),
				prevEl: this.block.querySelector( '.swiper-button-prev' ),
			},
			breakpoints: {
				600: {
					slidesPerView: 1.5,
				},
				768: {
					slidesPerView: 1.75,
				},
				992: {
					slidesPerView: 2.25,
				},
				1400: {
					slidesPerView: 2.5,
				},
			}
		});
	}
}

document.querySelectorAll('.block-media-carousel').forEach((block) => {
	new MediaCarousel( block );
});
  • Select images or videos from the media library to display
  • Images show at a larger size in a lightbox
  • Videos launch and play in a lightbox
    • Video data controlled from CPT. Can be youtube, vimeo or mp4

Animation: