windows监听滚动事件,滚动满足fixed条件时,元素一直抖动是什么原因? window.addEventListener('scroll', this.handleTabFix, true) handleTabFix () { let timeOut = null clearTimeout(timeOut) timeOut = setTimeout(() => { let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop let offsetTop = document.querySelector('#testNavBar') && document.querySelector('#testNavBar').offsetTop + 60 scrollTop > offsetTop ? this.isFixTab = true : this.isFixTab = false // isFixTab为true时,设置元素为fixed }, 1000) }