js-滚动条平滑滚动

 mainContent.scroll({
          top: sections[val].offsetTop - 150,
          left: 0,
          behavior: "smooth" //滚动条平滑滚动
        });
原文地址:https://www.cnblogs.com/huangmin1992/p/10843686.html