HTML:button按钮也可以
<div class="return top_btn ng-scope" style="display: block;"></div>
css:
.return { position: fixed; right: 2%; bottom: 4.6%; width: 48px; height: 48px; background: url(../images/up_top@2x.png); background-size: 100% 100%; cursor: pointer; }
js:
$(document).ready(function () {
$(".top_btn").hide();
$(function () {
$(window).scroll(function () {
if ($(window).scrollTop() > 100) {
$(".top_btn").fadeIn(1500);
} else {
$(".top_btn").fadeOut(1500);
}
});
//当点击跳转链接后,回到页面顶部位置
$(".top_btn").click(function () {
$('body,html').animate({
scrollTop: 0
},
1000);
return false;
});
});
});
继续阅读与本文标签相同的文章
-
海思向公开市场推出首款4G通信芯片Balong 711
2026-05-18栏目: 教程
-
猫和老鼠:5种药水效果可以叠加吗?这2种药水效果会有冲突!
2026-05-18栏目: 教程
-
自媒体教程,深度剖析平台的推荐机制原理,了解怎么获取高流量
2026-05-18栏目: 教程
-
宽带故障怎么办?教你几招,轻松解决!
2026-05-18栏目: 教程
-
Python 3.8刚刚发布!一分钟了解新版本的强大功能!
2026-05-18栏目: 教程
