Skip to content

Commit 242c2f9

Browse files
authored
Capture the right click event
1 parent 1a07fa7 commit 242c2f9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,17 @@ for(let [key,value] of Object.entries(obj)){
345345
// order is not guaranteed
346346
347347
```
348+
# Capture the right click event
349+
350+
```javascript
351+
window.oncontextmenu = () => {
352+
console.log('right click');
353+
return false // cancel default menu
354+
}
355+
//or
356+
357+
window.addEventListener('contextmenu', ()=>{
358+
console.log('right click');
359+
return false // cancel default menu
360+
},false)
361+
```

0 commit comments

Comments
 (0)