问题
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