//页面滚动
goThrough(item) {
var offsetTop;
switch (item) {
case 0:
offsetTop = this.$refs.offsetBox1.getBoundingClientRect().top
console.log(offsetTop)
// document.documentElement.scrollTop = offsetTop //不是平滑滚动
$("html,body").animate({
scrollTop: offsetTop }, 300);
break;
vue获取元素距离顶部的距离,结合jq实现元素瞄点平滑移动
最新推荐文章于 2023-09-25 11:40:10 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)