Search code examples
javascripttouchyuiyui3

Simulating touch event on YUI 3


I want to simulate / fire a touch event (touchstart or touchend) on a link with YUI 3.

The function .simulate doesn't handle the 'touch event', but only click/dblclick etc....

When i search in the official doc, there is nothing about it on the event section.

Is there anyway to do this ?

Thanks


Solution

  • I'm not sure you can use touchstart or touch{move,end} on non-touch device. Maybe you want to try to fire a 'gesturemovestart', that should be cross-device. Y.one.('#yourLink').fire('gesturemovestart') See http://yuilibrary.com/yui/docs/event/touch.html#move

    When the link is clicked, I fire 'gesturemovestart': http://jsfiddle.net/DrMw8/

    Best regards, Ludo