add touch events

This commit is contained in:
vance 2024-05-02 21:22:25 -07:00
parent 4acb6e701c
commit 74573d8f7c

View File

@ -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';
});
});