最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Making ion slides slide vertically - Stack Overflow

programmeradmin0浏览0评论

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'
    };
}

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'
    };
}
Share Improve this question edited Sep 2, 2016 at 11:15 Wim Ombelets 5,2653 gold badges42 silver badges58 bronze badges asked Sep 2, 2016 at 9:32 Ravi ZarekarRavi Zarekar 551 silver badge8 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

You need to add the options in the ion-slides ponent 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>

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

you can make your slides vertical by adding ''direction'' parameter.

<ion-slides direction="vertical">

</ion-slides>

by default slides are horizontal.

发布评论

评论列表(0)

  1. 暂无评论