Advertisement
fakesamgregory

Detect Mouse/Keyboard User

Jan 10th, 2024
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.33 KB | Source Code | 0 0
  1. window.addEventListener("keyup", (e) => {
  2.   document.documentElement.classList.add("keyboard-user");
  3.   document.documentElement.classList.remove("mouse-user");
  4. });
  5.  
  6. window.addEventListener("mousemove", () => {
  7.   document.documentElement.classList.remove("keyboard-user");
  8.   document.documentElement.classList.add("mouse-user");
  9. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement