如何快速找到是哪个元素产生的滚动
君哥
阅读:2602
5年前
评论:0
使用下面的代码粘贴到调试工具中运行一下,然后滚动页面,就可以看到是哪个元素产生的滚动了
function findscroller(element) {
element.onscroll = function () {
console.log(element)
}
Array.from(element.children).forEach(findscroller)
}
findscroller(document.body)
发表评论



![[数组的方法总结篇]02.数组的es5方法](http://www.yanjun202.com/zb_users/theme/ydlinuxse/include/random/2.jpg)