Exporteren (0) Afdrukken
Alles uitvouwen
EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

pointerType property

Returns whether the source of the event is touch, pen or mouse.

This property is read-only.

Internet Explorer 10

 

Syntax

JavaScript
ptr = object.pointerType

 

Property values

Type: Any

touch

The PointerEvent originated from touch input.

pen

The PointerEvent originated from pen input.

mouse

The PointerEvent originated from mouse input.

"" (empty string)

The PointerEvent originated from an unknown input type.

Remarks

Note  This item described in this topic requires Windows 8 or later.

In Internet Explorer 11, this property has been changed to return a string value. In Internet Explorer 10, it provided a return type of long:

  • MSPOINTER_TYPE_TOUCH: 0x00000002
  • MSPOINTER_TYPE_PEN: 0x00000003
  • MSPOINTER_TYPE_MOUSE: 0x00000004

The following example uses pointerType to check whether a pointer is primary from inside events other than onmspointerdown.


elm.addEventListener("pointerdown",handleDown,false);
function handleDown(evt) {
  if(evt.pointerType == "touch") {
    // Do something for touch input only
  }else{
    // Do something for non-touch input
  }
}


See also

PointerEvent
isPrimary

 

 

Weergeven:
© 2014 Microsoft