ctrlc+ctrlv一段用js实现sticky定位
let demo = document.querySelector('.DiscussionPage-nav>ul')
if(demo){let demoHeight = demo.offsetTop
window.addEventListener('scroll', function() {
if(demo){
var scrollTop = document.documentElement.scrollTop
if(scrollTop >= (250)) {
demo.style.position = 'fixed';
demo.style.top = '30px';
} else {
demo.style.position = 'absolute';
demo.style.top = '30px';
demo.style.marginTop = '0px';
}
}
}
)
}