detail プロパティ
event.detail
detail プロパティは、イベントが何回発生したかを返す UiEvent のプロパティです。
document.getElementById("example").onwheel = (event) => {
console.log( event.detail );
}
詳しくはExample
を参照してください
例えば、onclickイベントでマウスをクリック、ダブルクリックなどのクリック操作を何回したかを返すことができます。
クリックは1、ダブルクリックは2を返します。
onmousedownやonmouseupイベントから取得すると、クリック数に+1した数値を返します。
onmouseoverやonmouseoutイベントでは常に0を返します。
ページ内 Index
- ad -
構文(Syntax)
返り値はNumber型で、読み取り専用です。
Number = event.detail;
返り値(Return Values)
Type | 摘要 |
---|---|
Number | イベントの発生数 |
Example
detail プロパティの例です。確認
ボタンをクリックして実行してみてください。
操作内容は開発コンソールで確認ができます。
- ad -