Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
    };
}
like image 308
Ravi Zarekar Avatar asked Sep 02 '16 09:09

Ravi Zarekar


People also ask

How do you make an ionic slider?

How to implement an Ionic item slider. Ionic item slider is one of many pre-made components available in the Ionic framework. The ionic sliding item component contains child items that can be dragged to reveal action. All options to reveal should be placed in the item options element.

How do you use an ion slide?

By default, Ionic Slides components use the built-in slide animation effects. But, you can also use the custom animations for your Slides components. It can be done by using the options property, which looks like below syntax. You can find the different slider parameter options from here.


2 Answers

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>
like image 84
Adrian Avatar answered Oct 04 '22 07:10

Adrian


In the new version of ionic we can easily achieve vertical scroll by passing [options] value to <ion-slides>.

Here is an example.

// page.ts
export class SlideClass {
  slideOptions = {
    direction: 'vertical',
  };
  constructor(){}
 
}

// html file
<ion-slides [options]="slideOptions">

More option we can found here more slide options

like image 33
Anish Agarwal Avatar answered Oct 04 '22 08:10

Anish Agarwal