Slides height of the biggest content

#1

Hello All,

I am having an issue. My slide is taking at the maximum 100vh
I would like to take at maximum the height of the biggest slide.

I am not talking about autoHeight which is setting the size to the height content of the current slide.

Do you maybe have a code sample?

#2

So I found solution:

html

<ion-slides>
<ion-slide *ngFor="let slide of slides">
<div #slideContainer>
<!-- put your slide content here which have different size-->
</div>
</ion-slide>
</ion-slides>

ts file

  @ViewChildren("slideContainer") slideContainers: QueryList<ElementRef>;

ngAfterViewInit() {
   this.slides.autoHeight = true;
   this.resizeSlides();
}

resizeSlides() {
          setTimeout(() => {
            
            let biggestElement = 0;
            
            this.slideContainers.forEach(elem => {
              if(elem.nativeElement.clientHeight > biggestElement) {
                biggestElement = elem.nativeElement.clientHeight;
              }
            });

            this.slideContainers.forEach(elem => {
              if(elem.nativeElement.clientHeight < biggestElement) {
                elem.nativeElement.style.height = biggestElement + "px"; 
              }
            });
          }, 1)
        }