Skip to content

Option for fixed height at tallest slide when using fade type? #134

@eiranix

Description

@eiranix

When using the 'fade' type, it would be very helpful to have an option to set the slider height based on the tallest slide.

At the moment I am doing it like this:

sliderHeight();
window.addEventListener('load', sliderHeight); //To allow for fonts loading
window.addEventListener('resize', sliderHeight);

function sliderHeight() {
	if(document.querySelector('.my-slider .splide__list')) {
		var list = document.querySelector('.banner-slider .splide__list');
		list.style.height = '';
		var slides = list.querySelectorAll('.splide__slide');
		var h = slides[0].scrollHeight;
		for (i=0; i < slides.length; i++) {
			if(slides[i].scrollHeight > sliderH) {
				h = slides[i].scrollHeight;
			};
		};
		list.style.height = h + 'px';
	};
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions