// 平滑的滚动到底部 const scrollToBottom = (element) => element.scrollIntoView({ behavior: "smooth", block: "end" }); // 平滑的滚动到顶部 const scrollToTop = (element) => element.scrollIntoView({ behavior: "smooth", block: "start" });
behavior: "smooth" 平滑,
block:"start" | "end" :顶部 或者 底部
标签:滚动,顶部,smooth,element,behavior,js,block From: https://www.cnblogs.com/grow-up-up/p/17001249.html