File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ function show_loading() {
192
192
return loading ;
193
193
}
194
194
195
- function router ( ) {
195
+ function router ( ) {
196
196
197
197
var path = location . hash . replace ( "#" , "./" ) ;
198
198
@@ -212,6 +212,10 @@ function router() {
212
212
path = path + ".md" ;
213
213
}
214
214
215
+ // 取消scroll事件的监听函数
216
+ // 防止改变下面的变量perc的值
217
+ $ ( window ) . off ( 'scroll' ) ;
218
+
215
219
// otherwise get the markdown and render it
216
220
var loading = show_loading ( ) ;
217
221
$ . get ( path , function ( data ) {
@@ -283,7 +287,7 @@ function router() {
283
287
var h = $ ( 'body' ) . height ( ) ;
284
288
var sHeight = h - wh ;
285
289
286
- $w . off ( 'scroll' ) . on ( 'scroll' , function ( ) {
290
+ $w . on ( 'scroll' , function ( ) {
287
291
var perc = Math . max ( 0 , Math . min ( 1 , $w . scrollTop ( ) / sHeight ) ) ;
288
292
updateProgress ( perc ) ;
289
293
} ) ;
You can’t perform that action at this time.
0 commit comments