vue平滑的滚动到指定位置
第一种方法:1.csshtml,body {/* scroll-behavior: smooth; */}2.jsdocument.documentElement.scrollTop = document.body.scrollTop =this.vdaH;第二种方法js//downLoaction指定位置的idthis.$el.querySelector(`#downLoaction`).scr
·
第一种方法:
1.css
html,body { /* scroll-behavior: smooth; */ }
2.js
document.documentElement.scrollTop = document.body.scrollTop = this.vdaH;
第二种方法
js
//downLoaction指定位置的id
this.$el.querySelector(`#downLoaction`).scrollIntoView({
behavior: "smooth", // 平滑过渡
block: "start" // 上边框与视窗顶部平齐。默认值
});
更多推荐
已为社区贡献2条内容
所有评论(0)