标签:处理 rip and oct out res css 滚动 fun
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <link rel="stylesheet" href="../css_com/reset.css"> <style> .parent{ overflow: auto; margin:10px auto; width: 300px; height: 300px; border:1px solid red; } .child{ margin:0 auto; width: 200px; height: 2400px; background-color: #56fff3; } </style> <!--网络cdn提供jquery,自己下载好引用一样--> <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script> </head> <body> <!--<div class="parent" id="parent">--> <!----> <!--</div>--> <div class="child" id="child"></div> <script> // 防抖 function debounce(fn, wait) { var timeout = null; return function() { if(timeout !== null) clearTimeout(timeout); timeout = setTimeout(fn, wait); } } // 处理函数 function handle() { console.log(Math.random()); } // 滚动事件 window.addEventListener(‘scroll‘, debounce(handle, 1000)); </script> </body> </html>
标签:处理 rip and oct out res css 滚动 fun
原文地址:https://www.cnblogs.com/SpringAndMoon/p/12117911.html