-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09app.js
More file actions
20 lines (18 loc) · 824 Bytes
/
09app.js
File metadata and controls
20 lines (18 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const clickBtn = document.querySelector(".clear-tasks");
const card = document.querySelector(".card");
const heading = document.querySelector("h5");
// clickBtn.addEventListener("click", runEvent);
// clickBtn.addEventListener("dblclick", runEvent);
// clickBtn.addEventListener("mousedown", runEvent);
// clickBtn.addEventListener("mouseup", runEvent);
// card.addEventListener("mouseenter", runEvent);
// card.addEventListener("mouseleave", runEvent);
// card.addEventListener("mouseover", runEvent);
// card.addEventListener("mouseout", runEvent);
card.addEventListener("mousemove", runEvent);
// Event handler
function runEvent(e) {
console.log(`EVENT TYPE:${e.type}`);
heading.textContent = `MouseX:${e.offsetX},MouseY:${e.offsetY}`;
document.body.style.backgroundColor = `rgb(${e.offsetX},${e.offsetY},40)`;
}