What is the best way to implement swipe navigation in Angular 2?

后端 未结 4 1570
[愿得一人]
[愿得一人] 2020-12-12 23:24

I\'m new to Angular 2 and am looking for a way to implement a good tab touch swipe navigation for mobile users with a swipe transition to the next tab view.

So far I

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 00:05

    First install hammerjs and action touch-action polyfill:

    $ npm install hammerjs hammer-timejs
    

    Then add the imports to 'app.module.ts' so they will be used/bundled:

    import 'hammerjs';
    import 'hammer-timejs';
    

    Now you can handle the events for the actions:
    Rotate
    Pinch
    Press
    Pan
    Tap
    Swipe

    For example you can say:

  • Or:

    Reference: https://saschwarz.github.io/angular2-gestures-slides/#/

提交回复
热议问题