mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-04-08 11:56:41 +00:00
Add details to event notes
This commit is contained in:
parent
0fa769f448
commit
bd283e24ad
1 changed files with 4 additions and 0 deletions
|
@ -16,6 +16,7 @@ Event Types:
|
||||||
var domNode = document.getElementById("id");
|
var domNode = document.getElementById("id");
|
||||||
|
|
||||||
var onEvent = function(event) { // parameter contains info on the triggered event
|
var onEvent = function(event) { // parameter contains info on the triggered event
|
||||||
|
event.preventDefault(); // block execution of default action
|
||||||
// logic here
|
// logic here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +40,12 @@ Event Options:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
let event = new Event(type [,options]); // create the event, type can be custom
|
let event = new Event(type [,options]); // create the event, type can be custom
|
||||||
|
let event = new CustomEvent(type, { detail: /* custom data */ }); // create event w/ custom data
|
||||||
domNode.dispatchEvent(event); // launch the event
|
domNode.dispatchEvent(event); // launch the event
|
||||||
```
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Animation
|
## Animation
|
||||||
|
|
||||||
The window object is the assumed global object on a page.
|
The window object is the assumed global object on a page.
|
||||||
|
|
Loading…
Add table
Reference in a new issue