Search code examples
javascriptionic-frameworkionic2

Making ion slides slide vertically


I have start.html file having options property having of the and I will define them in options1 in class StartPage

<ion-slide [options]="option1" *ngFor="let slide of slides; let last = last">
  <img [src]="slide.image" class="slide-image"/>
  <h2 class="slide-title" [innerHTML]="slide.title" style=""></h2>
  <p [innerHTML]="slide.description"></p>

  <div id="skip-b">
    <button (click)="dismiss()">
      {{last ? "Let's Begin" : "Skip" }}
      <ion-icon name="arrow-forward"></ion-icon>
    </button>
  </div>
</ion-slide>

start.ts:

export class StartPage {
    option1 = {
        loop: true,
        direction: 'vertical'
    };
}

Solution

  • You need to add the options in the ion-slides component as shown in their docs.

    <ion-slides [options]="option1">
        <ion-slide *ngFor="let slide of slides; let last = last">
            <img [src]="slide.image" class="slide-image" />
            <h2 class="slide-title" [innerHTML]="slide.title" style=""></h2>
            <p [innerHTML]="slide.description"></p>
    
            <div id="skip-b">
                <button (click)="dismiss()">
          {{last ? "Let's Begin" : "Skip" }}
          <ion-icon name="arrow-forward"></ion-icon>
        </button>
            </div>
        </ion-slide>
    </ion-slides>