【问题标题】:Simulating touch event on YUI 3在 YUI 3 上模拟触摸事件
【发布时间】:2012-07-14 22:25:31
【问题描述】:

我想在 YUI 3 的链接上模拟/触发触摸事件(touchstart 或 touchend)。

.simulate 函数不处理“触摸事件”,而只处理 click/dblclick 等......

当我在官方文档中搜索时,事件部分没有任何内容。

有没有办法做到这一点?

谢谢

【问题讨论】:

标签: javascript touch yui yui3


【解决方案1】:

我不确定您是否可以在非触控设备上使用 touchstart 或 touch{move,end}。 也许您想尝试触发“gesturemovestart”,这应该是跨设备的。 Y.one.('#yourLink').fire('gesturemovestart') 见http://yuilibrary.com/yui/docs/event/touch.html#move

点击链接时,我会触发“gesturemovestart”:http://jsfiddle.net/DrMw8/

最好的问候, 卢多

【讨论】:

  • 我的开发是为 iPad/iPhone 开发的,所以该设备是触控式的。只是我使用 webViews。
  • 这些都不行吗? Y.one.('#yourLink').fire('gesturemovestart');或 Y.one.('#yourLink').fire('touchstart');
【解决方案2】:

不,尚不支持模拟触摸事件。它记录在这里:http://yuilibrary.com/yui/docs/event/simulate.html#no-touch-events-yet

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-22
    • 2010-11-02
    • 1970-01-01
    • 1970-01-01
    • 2015-11-01
    • 1970-01-01
    相关资源
    最近更新 更多