马黑PHP整站系统

      1
2345678
9101112131415
16171819202122
23242526272829
3031     

[复位日记]

最新评论

悄然
飞飞
马黑
悄然
飞飞

网站统计

·今日访问 : 46
·页面点击 : 47
·当前在线 : 1

2025年3月30日 星期日[阅读 44]

DS给出的兼容移动端代码建议:


let startX;

function handleStart(e) {
  const event = e.type === 'touchstart' ? e.touches[0] : e;
  startX = event.clientX;
}

function handleMove(e) {

  const event = e.type === 'touchmove' ? e.touches[0] : e;
  const deltaX = event.clientX - startX;
  console.log(`位移:${deltaX}px`);
}

element.addEventListener('mousedown', handleStart);

element.addEventListener('mousemove', handleMove);

element.addEventListener('touchstart', handleStart);

element.addEventListener('touchmove', handleMove);

2025': 前一则  下一则    

发表评论:

       

Copyright © 2023 All Right Reserved 马黑PHP文章管理整站系统v1.8
联系我们: gxblk@163.com