Skip to content

Commit 4aa09af

Browse files
committed
add touch and mouse move event for scratch card effect
1 parent a9a31f0 commit 4aa09af

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Scratch card effect/script.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
document.addEventListener('pointermove', function (e) {
1+
const pointerHandler = function (e) {
22
const body = document.querySelector('body');
33
const bubbles = document.createElement('span');
44

@@ -7,4 +7,8 @@ document.addEventListener('pointermove', function (e) {
77

88
body.appendChild(bubbles);
99

10-
})
10+
}
11+
12+
// document.addEventListener('pointermove', pointerHandler)
13+
document.addEventListener('mousemove', pointerHandler)
14+
document.addEventListener('touchmove', pointerHandler)

0 commit comments

Comments
 (0)