本文实例为大家分享了vue实现移动端返回顶部的具体代码,供大家参考,具体内容如下
HTML:
1
▲
JS:
$("html")
.stop()
.animate(
//animate:动画 点击时让它行动
{
scrollTop: 0 //距离顶部为0
},
1000 //多少时间完成行动
);
}
}
};
CSS:
.back1 { width: 50px; height: 50px; background: #eee; position: fixed; right: 5px; bottom: 50px; z-index: 1000; text-align: center; line-height: 50px; }
之前小编看到的一篇文章分享给大家:Vue实现返回顶部按钮
//数据源
.scrollTop{
width: 100%;
height: 100vh;
overflow-y: scroll;
}
.backTop {
position: fixed;
bottom: 50px;
z-index: 100;
right: 0;
background: white;
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



