1. let bodyEl = document.body
    2. let top = 0
    3. function stopBodyScroll (isFixed) {
    4. if (isFixed) {
    5. top = window.scrollY
    6. bodyEl.style.position = 'fixed'
    7. bodyEl.style.top = -top + 'px'
    8. } else {
    9. bodyEl.style.position = ''
    10. bodyEl.style.top = ''
    11. window.scrollTo(0, top) // 回到原先的top
    12. }
    13. }