Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Swiping between pages (up or down)

$
0
0

@Hesters wrote:

Hi everyone!

My basic question is: How do you swipe between pages up and down? I would like to have it so the page transition gets animated just as if you push a page on the navCtrl. Let me explain in more detail.

Here is my code for being able to swipe left and right:

HTML:

<ion-content (swipe)="swipeEvent($event)" padding>
  <ion-list>
    <button ion-item *ngFor="let item of items">
      {{ item.text }}
    </button>
  </ion-list>
</ion-content>

Typescript:

  swipeEvent(e) {
    if (e.direction == 4) {
      this.navCtrl.pop();
    }
  }

I use direction == 2 for the swipe left to get to the page (push) and swipe right to go back (pop). The animation then transitions the page in from right to left, when I push. And the animations shows the page being wiped out from left to right when I pop.

So my questions are:
Is there a more efficient way to swipe between pages (left / right)?
How do I get the swipeEvent to recognize up and down (e.direction == 8 / 16 for up and down doesn't work)?
How do I get the page to be animated, that it transitions in from bottom to top when I push and transitions away from top to bottom when I pop?

I use Ionic 3.x on iOS Sierra on Mac.

Any help is much appreciated! Thank you for your help in advance :slight_smile:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>