锚点的使用

1.首先需要定义跳转的位置

<div id="anchorID"></div>
2.直接使用如下方式即可
document.getElementById('anchorID').scrollIntoView({
       behavior:"smooth"
 })
posted @ 2024-10-12 09:44  埃菲尔上的加菲猫  阅读(16)  评论(0)    收藏  举报