把下面代码粘贴到调试工具中运行一下,然后滚动页面,就可以看到log是那个元素产生的滚动
function findScroller(element) {
element.onscroll = function() { console.log(element)}
Array.from(element.children).forEach(findScroller);
}
findScroller(document.body);
把下面代码粘贴到调试工具中运行一下,然后滚动页面,就可以看到log是那个元素产生的滚动
function findScroller(element) {
element.onscroll = function() { console.log(element)}
Array.from(element.children).forEach(findScroller);
}
findScroller(document.body);
本文标题:web-快速找到哪个元素产生的滚动
本文链接:https://www.haomeiwen.com/subject/yzocyrtx.html
网友评论