Components
53
Accordion Items Animated Gallery Basic Hero Basic Map Case Studies Feed Case Studies Hero Case Study Hero Case Study Slider Column Content Content Grid Content Image Content Slider Cta Cta Blocks Embed Block Enriched Accordion Error Event Feed Example Features Slider Full Width Image Hero Full Width Media Image And Form Image Content Image Split Content Image Stats Logo Slider Map Post Feed Pricing Publications Feed Simple Accordion Simple Header Simple Hero Solutions Animated Block Split Content Split Content Carousel Split Content Content Split Content Post Split Content Pricing Split Content Video Split Image Hero Stats Slider Team Carousel Team Hero Team Listing Testimonial Case Study Timeline Trivia Bar Two Column Rich Text Vacancies Table Video Video Expand

Case Study Slider

There are no ACF fields assigned to this component.

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

.block-case-study-slider {
	padding: 4rem 0;

	&__wrapper{
		@include bp($md, 'true'){
			display: flex;
			flex-direction: column-reverse;
			gap: 1.5rem;
		}
	}

	&__item-image-container {
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;
		z-index: 0;

		img, picture{
			width: 100%;
			height: 100%;
			object-fit: cover;
			object-position: center;
		}

		&::before {
			content: '';
			background: linear-gradient(0, var(--primary), transparent);
			top: 0;
			left: 0;
			position: absolute;
			width: 100%;
			height: 100%;
			z-index: 2;
		}
	}

	&__item {
		height: 90vh;
		margin: 0;
		position: relative;
		border-radius: 0;
		overflow: hidden;

		@include bp($md){
			border-radius: 52px;
			margin: 0 20px;
			height: 80vh;
		}

		&-case-study{
			position: absolute;
			left: 20px;
			bottom: 20px;
			background: var(--white);
			padding: 32px;
			border-radius: 32px;
			width: calc(100% - 104px);
			display: block;
			text-decoration: none;

			@include bp($sm){
				width: 30%;
				border-radius: 50px;
			}

			@include bp($lg){
				width: 20vw;
			}

			&:hover{
				.ico{
					transform: translateX(6px);
					transition: .6s ease-in-out;
				}
			}
		}

		&-case-study-meta{
			display: flex;
			flex-direction: column;

			.label{
				background: var(--primary);
				font-size: 14px;
				text-transform: uppercase;
				padding: 2px 6px;
				border-radius: 4px;
				color: var(--white);
				width: fit-content;
				display: inline-block;
			}

			.value{
				border: solid 1px rgba(56,53,81,0.2);
				padding: 2px 6px;
				border-radius: 4px;
				font-size: 14px;
				width: fit-content;
				display: inline-block;
				color: var(--primary);
			}
		}

		&-case-study-title{
			margin-top: 20px;

			h3{
				@include fluid-type(18, 24);
				font-weight: 600;
				margin-bottom: 20px;
			}
		}

		&-case-study-link{
			display: flex;
			flex-direction: row;
			align-items: center;
			gap: 4px;
			margin-bottom: 20px;
			font-weight: 600;
			text-decoration: none;
			transition: .3s ease-in-out;

			&:hover{
				.ico{
					transform: translateX(6px);
					transition: .6s ease-in-out;
				}
			}

			.ico{
				width: 16px;
				height: 16px;
				transition: .6s ease-in-out;

				&--arrow-circle{
					background-image: url("data:image/svg+xml,%3Csvg width='23' height='23' viewBox='0 0 23 23' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11.8623' cy='11.5103' r='10.5' stroke='%23383551'/%3E%3Cpath d='M15.1621 15.5103L18.3621 11.5103L15.1621 7.51025' stroke='%23383551'/%3E%3Cpath d='M18.3623 11.5103L5.3623 11.5103' stroke='%23383551'/%3E%3C/svg%3E%0A");
				}

			}
		}

		&-case-study-logo-container{
			background: $grey-4;
			padding: 24px;
			border-radius: 32px;
			border: solid 1px rgba(56,53,81,0.2);
			margin: 0 -22px -22px -22px;
			display: flex;
			align-items: center;
			justify-content: center;
			min-height: unset;
			text-align: center;

			@include bp($sm){
				border-radius: 44px;
			}

			@include bp($lg){
				min-height: 104px;
			}

			img{
				width: 70%;

				@include bp($lg){
					width: 60%;

				}

			}
		}
	}

	&__navigation-container{
		display: flex;
		flex-direction: row;
		align-items: flex-end;
		gap: 8px;
		justify-content: space-between;
		margin-bottom: 1rem;
		padding: 0 1rem;

		@include bp($sm){
			padding: 0 1.5rem;
			margin-bottom: 2rem;
		padding: 0 1rem;
			justify-content: flex-end;
		}
	}

	&__navigation-btn{
		width: 44px;
		height: 44px;
		border-radius: 100px;
		border: solid 1px var(--text-color);
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		transition: .3s ease-in-out;
		background-position: center;
		background-repeat: no-repeat;
		background-size: 24px;

		&-prev{
			background-image: url("data:image/svg+xml,%3Csvg width='27' height='18' viewBox='0 0 27 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.16895 16.7598L0.768945 8.75977L7.16895 0.759765' stroke='%23383551'/%3E%3Cpath d='M0.768555 8.75977L26.7686 8.75977' stroke='%23383551'/%3E%3C/svg%3E%0A");
		}

		&-next{
			background-image: url("data:image/svg+xml,%3Csvg width='28' height='18' viewBox='0 0 28 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.3682 16.7598L26.7682 8.75977L20.3682 0.759765' stroke='%23383551'/%3E%3Cpath d='M26.7686 8.75977L0.768555 8.75977' stroke='%23383551'/%3E%3C/svg%3E%0A");
		}

		&:hover{
			background-color: var(--text-color);

			&.block-case-study-slider__navigation-btn-prev{
				background-image: url("data:image/svg+xml,%3Csvg width='27' height='18' viewBox='0 0 27 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.16895 16.7598L0.768945 8.75977L7.16895 0.759765' stroke='%23fff'/%3E%3Cpath d='M0.768555 8.75977L26.7686 8.75977' stroke='%23fff'/%3E%3C/svg%3E%0A") ;
			}

			&.block-case-study-slider__navigation-btn-next{
				background-image: url("data:image/svg+xml,%3Csvg width='28' height='18' viewBox='0 0 28 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.3682 16.7598L26.7682 8.75977L20.3682 0.759765' stroke='%23fff'/%3E%3Cpath d='M26.7686 8.75977L0.768555 8.75977' stroke='%23fff'/%3E%3C/svg%3E%0A") ;
			}
		}

	}

	&.has-primary-background-color, &.has-secondary-background-color{
		.block-case-study-slider__navigation-btn-prev{
			background-image: url("data:image/svg+xml,%3Csvg width='27' height='18' viewBox='0 0 27 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.16895 16.7598L0.768945 8.75977L7.16895 0.759765' stroke='%23fff'/%3E%3Cpath d='M0.768555 8.75977L26.7686 8.75977' stroke='%23fff'/%3E%3C/svg%3E%0A");
		}

		.block-case-study-slider__navigation-btn-next{
			background-image: url("data:image/svg+xml,%3Csvg width='28' height='18' viewBox='0 0 28 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.3682 16.7598L26.7682 8.75977L20.3682 0.759765' stroke='%23fff'/%3E%3Cpath d='M26.7686 8.75977L0.768555 8.75977' stroke='%23fff'/%3E%3C/svg%3E%0A");
		}

		.block-case-study-slider__navigation-btn{
			&:hover{
				background-color: var(--text-color);

				&.block-case-study-slider__navigation-btn-prev{
					background-image: url("data:image/svg+xml,%3Csvg width='27' height='18' viewBox='0 0 27 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.16895 16.7598L0.768945 8.75977L7.16895 0.759765' stroke='%23383551'/%3E%3Cpath d='M0.768555 8.75977L26.7686 8.75977' stroke='%23383551'/%3E%3C/svg%3E%0A") !important;
				}

				&.block-case-study-slider__navigation-btn-next{
					background-image: url("data:image/svg+xml,%3Csvg width='28' height='18' viewBox='0 0 28 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.3682 16.7598L26.7682 8.75977L20.3682 0.759765' stroke='%23383551'/%3E%3Cpath d='M26.7686 8.75977L0.768555 8.75977' stroke='%23383551'/%3E%3C/svg%3E%0A") !important;
				}
			}
		}
	}
}

class CaseStudySlider {
	/**
	 * 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-case-study-slider');
		this.init();
	}

	/**
	 * Example function to run class logic
	 * Can access `this.block`
	 */
	init() {
		this.blocks.forEach((block) => {
			const carousel = block.querySelector('.block-case-study-slider__wrapper.swiper');
			if(carousel){
				const swiper = new Swiper(carousel, {
					loop: true,
					slidesPerView: 1,
					autoHeight: true,
					// effect: 'fade',
					autoplay: {
						delay: 5000
					},
					speed: 600,
					navigation: {
						nextEl: '.block-case-study-slider__navigation-btn-next',
						prevEl: '.block-case-study-slider__navigation-btn-prev',
					},
				});
			}
		});
	}
}

document.addEventListener('DOMContentLoaded', () => {
	new CaseStudySlider();
});
{
    "$schema": "https://schemas.wp.org/trunk/block.json",
    "apiVersion": 2,
    "name": "strategiq/case-study-slider",
    "title": "Case Study Slider",
    "description": "Example block to be used as a template",
    "category": "strategiq",
    "icon": "strategiq",
    "acf": {
        "mode": "preview",
        "renderTemplate": "block-case-study-slider.php"
    },
    "supports": {
        "anchor": true,
        "align": false,
        "color": {
            "background": false,
            "text": false,
            "gradients": false
        },
        "spacing": {
            "padding": [
                "top",
                "bottom"
            ],
            "margin": [
                "top",
                "bottom"
            ]
        }
    },
    "example": {
        "attributes": {
            "mode": "preview",
            "data": {
                "heading_type": "h2",
                "heading_text": "Example - Example",
                "content": "This is some example content to represent what the content will look like"
            }
        }
    },
    "style": [
		"file:../../assets/css/case-study-slider/block-case-study-slider.css",
		"swiper"
	],
	"viewScript": ["case-study-slider", "swiper"]
}
This component is not currently used on any pages.
There are is no readme file with this component.