X Tutup
Skip to content

Commit 4e48369

Browse files
author
Bernardo Sulzbach
committed
Minimalistic working pure-JS back to top.
Removed some crap.
1 parent cface82 commit 4e48369

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

_layouts/default.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33

44
{% include head.html %}
55

6-
<!-- <body data-spy="scroll" data-target="#myAffix"> -->
76
<body>
87

98
{% include header.html %}
109

11-
1210
<div id="main" class="container main">
1311
{{ content }}
1412
</div>
1513

16-
1714
<div id="top" data-toggle="tooltip" data-placement="left" title="Go to Top">
1815
<a href="javascript:;">
1916
<div class="arrow"></div>

static/js/index.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,32 +103,19 @@ function categoryAndTagDisplay() {
103103
});
104104
}
105105

106-
/**
107-
* 回到顶部
108-
*/
109106
function backToTop() {
110-
//滚页面才显示返回顶部
111107
$(window).scroll(function() {
112108
if ($(window).scrollTop() > 100) {
113109
$("#top").fadeIn(500);
114110
} else {
115111
$("#top").fadeOut(500);
116112
}
117113
});
118-
//点击回到顶部
119114
$("#top").click(function() {
120-
$("body").animate({
121-
scrollTop: "0"
122-
}, 500);
123-
});
124-
125-
//初始化tip
126-
$(function() {
127-
$('[data-toggle="tooltip"]').tooltip();
115+
window.scrollTo(0, 0);
128116
});
129117
}
130118

131-
132119
/**
133120
* 侧边目录
134121
*/

0 commit comments

Comments
 (0)
X Tutup