我想在用户在我的网络应用程序中滚动时添加事件侦听器,但无法正常工作
componentDidMount = () => {
let scrollPosition = window.scrollY;
let header = document.getElementById("topBar");
window.addEventListener('scroll', () => {
scrollPosition = window.scrollY;
console.log(scrollPosition)
});
}
你们能帮我解决这个问题吗?
心有法竹
慕后森
随时随地看视频慕课网APP
相关分类