<html> <head> <style> .box{width: 200px;height: 200px;background: #0a76a4} </style> </head> <body> <h2>js节流</h2> <div class="box"></div> <script> let box=document.querySelector(".box") box.addEventListener("touchmove",throttle(demo,1000)) function throttle(event,time) { let timer=null return function(){ if(!timer){ timer=setTimeout(()=>{ event() timer=null },time) } } } function demo(){ console.log("发起请求") } </script> </body> </html>