Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. PointerEvent
  4. width

PointerEvent: width property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.

Thewidth read-only property of thePointerEvent interface represents the width of the pointer's contactgeometry along the x-axis, measured in CSS pixels. Depending on the source of thepointer device (such as a finger), for a given pointer, each event may produce adifferent value.

If the input hardware cannot report the contact geometry to the browser, the widthdefaults to1.

Value

The width of the event's contact area (in CSS pixels).

Examples

This example illustrates using thePointerEvent interface'swidth andheight properties to calculate the contact area.

js
target.addEventListener("pointerdown", (ev) => {  // Calculate the contact area  const area = ev.width * ev.height;});

Specifications

Specification
Pointer Events
# dom-pointerevent-width

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp