![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javascript
aoyia
这个作者很懒,什么都没留下…
展开
-
防抖debounce/ 节流throttle
防抖节流//节流 throttle(func, delay) { let status = true; return function(...args) { if (!status) return false; status = false; setTimeout(() => { func.apply(this, args); status = true; //原创 2021-08-09 14:47:20 · 92 阅读 · 0 评论 -
js 拖拽元素 鼠标速度过快元素跟不上
自己写一个拖拽元素,使用js拖拽元素时,鼠标速度过快时 元素跟不上鼠标参考了网上的文章 ,里面对比了绑定到 body和document上的不同点js 拖拽元素 鼠标速度过快问题明白过来是因为速度过快而导致,鼠标脱离了小盒子box的范围问题代码: <div class="box"></div> //html <script> let box = document.querySelector('.box'); box.onmousedo原创 2021-06-26 17:04:58 · 6306 阅读 · 4 评论 -
js实现回到顶部效果。点击回到顶部 , 滚轮向下滚动中断回到顶部 , 停在当前位置
<style> .topBtn { width: 50px; height: 90px; position: fixed; bottom: 50px; right: 50px; background-color: palegreen; } .contain { width: 400px; height: 800px;原创 2021-06-26 14:45:26 · 518 阅读 · 0 评论