From 74573d8f7cafdbb5a282477873b8302188a7f39e Mon Sep 17 00:00:00 2001 From: vance Date: Thu, 2 May 2024 21:22:25 -0700 Subject: [PATCH] add touch events --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8f85630..59e76e2 100644 --- a/index.html +++ b/index.html @@ -138,8 +138,8 @@ // bonzi cursor ['mousemove', 'touchstart', 'touchmove'].forEach(type => { window.addEventListener(type, event => { - document.getElementById('cursor').style.top = event.clientY + 'px'; - document.getElementById('cursor').style.left = event.clientX + 'px'; + document.getElementById('cursor').style.top = (event.clientY || event.touches[0].clientY) + 'px'; + document.getElementById('cursor').style.left = (event.clientY || event.touches[0].clientY) + 'px'; }); });