【问题标题】:Angular2, HammerJs, swipeup not working with androidAngular2,HammerJs,swipeup 不适用于 android
【发布时间】:2016-11-15 20:08:39
【问题描述】:

我有一个 ngFor 项目列表。每个项目都有一个显示删除按钮的 swipeleft/swiperight 指令。 (想想 iOS 消息交互)。但是,当我去 swipeup 时,好像要滚动列表一样,我没有使用 android os 滚动。它确实识别了该事件,因为我可以添加调试并且在触发滑动时我得到响应,但是,它实际上并没有滚动列表。在 iOS 上,我没有问题。

这是我发现的一些代码,希望它能够正常工作,但在 android 上没有运气。

export class MyHammerConfig extends HammerGestureConfig  {
    overrides = <any>{
        'swipe': {velocity: 0.2, threshold: 10, direction: 31}
    }
}

我只是为幻灯片事件使用基本的hammerjs指令。

<div  class='list-item-hidden'   *ngFor="let conversation of conversationList" (swipeleft)="openMenu(conversation)" (swiperight)="openMenu(conversation)">

android 需要被 Hammerjs 和 swipeup 事件区别对待吗?

【问题讨论】:

    标签: android ios angular hammer.js


    【解决方案1】:

    您需要将此 css 添加到您的 dom 元素中,

     touch-action: pan-x pan-y !important;
    

    【讨论】:

      猜你喜欢
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      • 2021-07-13
      • 2017-09-07
      • 2017-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多