1
votes

I have problem with ion slides content height if i have different slides. I have set height auto but if i change to another slide height does not reset.

 <ion-slides #pageSlider (ionSlideWillChange)="changeWillSlide($event)" style="height:auto">
        <ion-slide>
            <h1>ContentTab 1</h1>
            <h1>ContentTab 1</h1>
            <h1>ContentTab 1</h1>
            some more content....

        </ion-slide>
        <ion-slide>
            <h1>ContentTab 1</h1>
            <h1>ContentTab 1</h1>
            some more content....

        </ion-slide>
        <ion-slide>
            <h1>ContentTab 1</h1>
            some more content....
        </ion-slide>
    </ion-slides>

Here is link to view project

https://stackblitz.com/edit/ionic-gyfjks?file=pages%2Fhome%2Fhome.html

Please help me to solve this issue.

1

1 Answers

0
votes

[duplicate Ionic - how to slide ion-segments?

simple and easy even logic only in the html, no need JS custom code. you can implement ion-slides and ion-segment that listen to 1 variable say segment

Toolbar: bind to segment, and listen ionChange

<ion-toolbar>
    <ion-segment (ionChange)="slides.slideTo(segment)" [(ngModel)]="segment"  color="warning">
      <ion-segment-button value="0">
        <ion-icon name="person"></ion-icon>
      </ion-segment-button>
      <ion-segment-button value="1">
        <ion-icon name="camera"></ion-icon>
      </ion-segment-button>
    </ion-segment>
  </ion-toolbar>

ion-slides: capture the slide event, assign segment to current active index

 <ion-slides #slides (ionSlideWillChange)="segment=''+slides.getActiveIndex()">
   <ion-slide>
     profile,
     hello <span *ngIf="this.userProvider.userData">{{this.userProvider.userData.name}}</span>

   </ion-slide>
   <ion-slide>
     second

   </ion-slide>
   <ion-slide>
     third

   </ion-slide>
 </ion-slides>