Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个活动溢出的 div,我希望在移动滚动时scrollTop在控制台中显示我,但我可以做到。请指导我。
scrollTop
试试这个,绑定窗口滚动并获取scrollTop来自窗口
$(window).on('scroll', function () { $('label').text($(this).scrollTop()); console.log($(this).scrollTop()); });
演示