Polymer: How to distinguish between finger tap or mouse click for “on-tap”?

夙愿已清 提交于 2019-12-11 13:55:27

问题


I have an element that has hover state (overlay). On desktop this works fine, however since there is no such thing as a mouseenter, I am making it so that tapping the overlay will show the other div. Therefore, I don't want the on-tap handler to get called when I tap on the element on my desktop.

On my iPhone device when I tap on the element, this is what I get back:

On my desktop browser I get this:

In my mocha tests, I get something completely different when I call actionCardOverlay.dispatchEvent(new CustomEvent('tap'));. Notice how there isn't even a detail for this one:

So my question is: How can I tell if a tap event is coming from a mouseclick or finger tap? If there is no way to distinguish between the two, then is there something other than on-tap that I can use that is mobile specific?

来源:https://stackoverflow.com/questions/34258991/polymer-how-to-distinguish-between-finger-tap-or-mouse-click-for-on-tap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!