質問

I've configured Pointer Events through pointerevents-polyfill.

There's an issue I have where I cannot differentiate between left- and right-clicks where right-clicking a nav item will do the same action as left-clicking instead of opening the right-click menu.

The specific event I'm using is pointerup.

Is there a way with Pointer Events to check if the event is a left- or right-click?

役に立ちましたか?

解決 2

I used event.type == 'click' (left) vs. event.type == 'contextmenu' (right).

他のヒント

Looks like there is a property called button that has a value of 0 if it's the primary pointer (left mouse button).

I haven't used this library but from looking at the source and the W3C spec it would appear that way.

You can always print/debug the event and see what the property is.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top