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() {
192192 return loading ;
193193}
194194
195- function router ( ) {
195+ function router ( ) {
196196
197197 var path = location . hash . replace ( "#" , "./" ) ;
198198
@@ -212,6 +212,10 @@ function router() {
212212 path = path + ".md" ;
213213 }
214214
215+ // 取消scroll事件的监听函数
216+ // 防止改变下面的变量perc的值
217+ $ ( window ) . off ( 'scroll' ) ;
218+
215219 // otherwise get the markdown and render it
216220 var loading = show_loading ( ) ;
217221 $ . get ( path , function ( data ) {
@@ -283,7 +287,7 @@ function router() {
283287 var h = $ ( 'body' ) . height ( ) ;
284288 var sHeight = h - wh ;
285289
286- $w . off ( 'scroll' ) . on ( 'scroll' , function ( ) {
290+ $w . on ( 'scroll' , function ( ) {
287291 var perc = Math . max ( 0 , Math . min ( 1 , $w . scrollTop ( ) / sHeight ) ) ;
288292 updateProgress ( perc ) ;
289293 } ) ;
You can’t perform that action at this time.
0 commit comments