Touch: Identifier-Eigenschaft
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Die Touch.identifier
-Eigenschaft gibt einen Wert zurück, der diesen Berührungspunkt auf der Oberfläche eindeutig identifiziert. Dieser Wert bleibt bei jedem Ereignis im Zusammenhang mit der Bewegung dieses Fingers (oder des Stifts) auf der Oberfläche konsistent, bis er von der Oberfläche abgehoben wird.
Wert
Ein long
, der die eindeutige ID des Touch
-Objekts darstellt.
Beispiele
js
someElement.addEventListener(
"touchmove",
(e) => {
// Iterate through the list of touch points that changed
// since the last event and print each touch point's identifier.
for (let i = 0; i < e.changedTouches.length; i++) {
console.log(
`changedTouches[${i}].identifier = ${e.changedTouches[i].identifier}`,
);
}
},
false,
);
Spezifikationen
Specification |
---|
Touch Events # dom-touch-identifier |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
identifier |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.