This commit is contained in:
24
index.html
24
index.html
@@ -562,4 +562,28 @@
|
||||
<img id="viewer" alt="" style="display: none;">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 回到顶部功能
|
||||
$(document).ready(function() {
|
||||
// 点击回到顶部
|
||||
$("#backTop").click(function () {
|
||||
$("html, body").animate({ scrollTop: 0 }, 600);
|
||||
});
|
||||
|
||||
// 根据滚动位置显示/隐藏回到顶部按钮
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() > 300) {
|
||||
$("#backTop").fadeIn(300);
|
||||
} else {
|
||||
$("#backTop").fadeOut(300);
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化时隐藏回到顶部按钮
|
||||
if ($(window).scrollTop() <= 300) {
|
||||
$("#backTop").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{include file="footer"}
|
||||
|
||||
Reference in New Issue
Block a user