File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,14 @@ body {
354354 }
355355}
356356
357+ .progress-indicator-2 {
358+ position : fixed;
359+ top : 0 ;
360+ left : 0 ;
361+ height : 3px ;
362+ background-color : # 0A74DA ;
363+ }
364+
357365/**
358366 * okaidia theme for JavaScript, CSS and HTML
359367 * Loosely based on Monokai textmate theme by http://www.monokai.nl/
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ var p = new Point();
1818
1919任何带有默认值的参数,被视为可选参数。不带默认值的参数,则被视为必需参数。
2020
21- 利用参数默认值,可以指定一个参数不得省略 ,如果省略就抛出一个错误。
21+ 利用参数默认值,可以指定某一个参数不得省略 ,如果省略就抛出一个错误。
2222
2323``` javascript
2424
Original file line number Diff line number Diff line change 2626 < div id ="loading "> Loading ...</ div >
2727 < div id ="error "> Opps! ... File not found!</ div >
2828 < div id ="flip "> < div id ="pageup "> 上一章</ div > < div id ="pagedown "> 下一章</ div > </ div >
29+ < div class ="progress-indicator-2 "> </ div >
2930
3031 < script >
3132 // essential settings
Original file line number Diff line number Diff line change @@ -258,6 +258,24 @@ function router() {
258258 $ ( '#pagedown' ) . css ( 'display' , 'inline-block' ) ;
259259 }
260260
261+ ( function ( ) {
262+ var $w = $ ( window ) ;
263+ var $prog2 = $ ( '.progress-indicator-2' ) ;
264+ var wh = $w . height ( ) ;
265+ var h = $ ( 'body' ) . height ( ) ;
266+ var sHeight = h - wh ;
267+ $w . off ( 'scroll' ) ;
268+ $w . on ( 'scroll' , function ( ) {
269+ var perc = Math . max ( 0 , Math . min ( 1 , $w . scrollTop ( ) / sHeight ) ) ;
270+ updateProgress ( perc ) ;
271+ } ) ;
272+
273+ function updateProgress ( perc ) {
274+ $prog2 . css ( { width : perc * 100 + '%' } ) ;
275+ }
276+
277+ } ( ) ) ;
278+
261279 } ) . fail ( function ( ) {
262280 show_error ( ) ;
263281
You can’t perform that action at this time.
0 commit comments