File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -112,13 +112,24 @@ <h3 class="panel-title">
112112 var top = $ ( ".category-index" ) . offset ( ) . top
113113 var height = $ ( window ) . height ( ) - 110 - 70
114114 var style = 'max-height:' + height + 'px' ;
115- if ( $ ( window ) . scrollTop ( ) - 15 >= top ) {
115+ var scrollTop = $ ( window ) . scrollTop ( )
116+ if ( scrollTop - 15 >= top ) {
116117 $ ( ".category-index .panel-default" ) . addClass ( "fixed" )
117118 $ ( ".category-index .panel-body" ) . attr ( "style" , style )
118119 } else {
119120 $ ( ".category-index .panel-default" ) . removeClass ( "fixed" )
120121 $ ( ".category-index .panel-body" ) . attr ( "style" , '' )
121122 }
123+ console . log ( scrollTop )
124+ var panels = $ ( ".category-detail>.panel" )
125+
126+ for ( var i = 0 ; i < panels . length ; i ++ ) {
127+ if ( $ ( panels [ i ] ) . offset ( ) . top - scrollTop >= 0 ) {
128+ $ ( ".category-index a" ) . removeClass ( "active" ) ;
129+ $ ( "[data-show=" + $ ( panels [ i ] ) . attr ( "id" ) + "]" ) . addClass ( "active" ) ;
130+ i = panels . length
131+ }
132+ }
122133 }
123134 $ ( ".cate-item" ) . tooltip ( ) ;
124135 $ ( ".category-index a" ) . tooltip ( ) ;
You can’t perform that action at this time.
0 commit comments